启动页广告

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


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

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

代码如下:

AppDelegate.h中的代码


#import <UIKit/UIKit.h>

 

@interface AppDelegate : UIResponder <UIApplicationDelegate>

 

@property (strongnonatomicUIWindow *window;

@property (strongnonatomicUIImageView *adImageView;

@property (strongnonatomicUINavigationController *rootNavi;

 

@end
 

AppDelegate.m中的代码

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

{

    self.window = [[UIWindow allocinitWithFrame:[[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(00, [[UIScreen mainScreenbounds].size.width, [[UIScreen mainScreen]bounds].size.height)];

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

    [self.window addSubview:self.adImageView];

    [self performSelector:@selector(removeAdImageView) withObject:nilafterDelay: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值