TAG

RSS订阅

收藏本站

设为首页

当前位置:主页 > 移动开发 > IOS开发 >

ios app启动图片,之后的广告图片效果

发布时间:2015-03-27 11:38 类别:IOS开发

转载请注明出处:http://www.wahenzan.com/a/mdev/ios/2015/0326/1688.html

来源:哇很赞(www.wahenzan.com)

之前很奇怪app启动之后的广告展示是怎么处理的,特意试了下效果,

下面是我简单实现的一个广告展示效果

代码如下:

AppDelegate.h中的代码


#import <UIKit/UIKit.h>

 

@interface AppDelegate : UIResponder <UIApplicationDelegate>

 

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) UIImageView *adImageView;

@property (strong, nonatomic) UINavigationController *rootNavi;

 

@end
 

AppDelegate.m中的代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.

    AlertDemoViewController *vc = [[AlertDemoViewController alloc]init];

    

    UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:vc];

    

    if (isIOS7) {

        [navi.navigationBar setBarTintColor:[UIColor clearColor]];

    }else{

        [navi.navigationBar setTintColor:[UIColor clearColor]];

    }

    self.rootNavi = navi;

    

    //self.window.rootViewController = navi;

    

    self.adImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];

    [self.adImageView setImage:[UIImage imageNamed:@"tmplecture"]];

    [self.window addSubview:self.adImageView];

    [self performSelector:@selector(removeAdImageView) withObject:nil afterDelay:3];

    

    self.window.backgroundColor = [UIColor whiteColor];

    [self.window makeKeyAndVisible];

    return YES;

}

 

- (void)removeAdImageView

{

    [UIView animateWithDuration:0.3f animations:^{

        self.adImageView.transform = CGAffineTransformMakeScale(0.5f, 0.5f);

        self.adImageView.alpha = 0.f;

    } completion:^(BOOL finished) {

        [self.adImageView removeFromSuperview];

        self.window.rootViewController = self.rootNavi;

    }];

}
转载请注明出处:http://www.wahenzan.com/a/mdev/ios/2015/0326/1688.html

来源:哇很赞(www.wahenzan.com)


猜你会喜欢....

Copyright © 2015 www.wahenzan.com 哇!很赞 版权所有 浙ICP备14030256号-1 Power by DedeCms

浙公网安备 33010602005986号

声明:本站所有文章除标明原创外,均来自网络转载,版权归原作者所有,如果有侵犯到您的权益,请联系本站删除 网站管理员:758763728

360网站安全检测平台