在启动页面后面再加载一个广告页,可以定制动画等

这个上面可以加载一些动画等
该方法要卸载appdelegate里面:
写到这个方法里面:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 
要注意  一定要卸载最下面,就是紧挨着  return YES上面,否则加载上以后还会看不到
 
案例:
先在.h中声明一个:
@property (strong, nonatomic) UIImageView *splashView;
 
然后回到.m文件中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   


//  
//    调用百度push设置方法
    [self baiduCloudPush:application andDic:launchOptions];
   
    // Override point for customization after application launch.
   
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
    //[self setUM];
    NSArray *paths= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    //获得documents的文件路径
    NSString *documentDirectory=[paths objectAtIndex:0];
    CLog(@"%@",documentDirectory);
    //[self locate];
    HomeViewController *homeVC = [[HomeViewController alloc]init];
    CommunityViewController *communityVC = [[CommunityViewController alloc]init];
    ShopViewController *shopVC = [[ShopViewController alloc]init];
    UserViewController *userCenterVC = [[UserViewController alloc]init];
    CustomTabBarController *MTabBar = [CustomTabBarController sharedCustomTabBarController];
    [MTabBar setViewControllers:[NSArray arrayWithObjects:homeVC,communityVC,shopVC,userCenterVC, nil]];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:MTabBar];
    nav.navigationBarHidden = YES;
    self.window.rootViewController = nav;
/*-------------------上面主要是一些配置,下面代码是加载动画---------------*/
  
    //    让试图可见
    [_window makeKeyAndVisible];
   
    //   加载试图一定要写在makeKeyAndVisible方法的下面否则将看不到。
    _splashView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height )];
    //将图片添加到UIImageView对象中
    _splashView.center = self.window.center;
    _splashView.image=[UIImage imageNamed:@"DL_background.png"];
    [self.window addSubview:_splashView];
 
//将UIImageView显示在window的最上面
    [self.window bringSubviewToFront:_splashView];
   
    [self performSelector:@selector(showWord) withObject:nil afterDelay:0.0f];
   
    return YES;
}





-(void)showWord
{
   
    UIImageView *word_ = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 80)];
    word_.center = self.window.center;
    word_.image = [UIImage imageNamed:@"LOGO"];
    [_splashView addSubview:word_];
   
    word_.alpha = 1.0;
// 动画执行延时执行1秒,执行1秒  delay表示延时
    [UIView animateWithDuration:1.0f delay:1.0f options:UIViewAnimationOptionCurveLinear
                     animations:^
     {
         word_.alpha = 0.0;
     }
                     completion:^(BOOL finished)
     {
         // 完成后执行code
         [NSThread sleepForTimeInterval:1.0f];
         [_splashView removeFromSuperview];
     }
     ];
}

转载于:https://www.cnblogs.com/AlienY/p/4664414.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值