iOS-界面淡化效果

2016-08-25  本文已影响68人  亦晴工作室
UITabBarController *tbc = (UITabBarController *)self.window.rootViewController;
    
    CGSize size = [UIScreen mainScreen].bounds.size;
    
    //标签栏view, 添加imageView, 添加UIView动画
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
    NSString *name = [NSString stringWithFormat:@"%d.jpg",arc4random()%5+1];
    imageView.image = [UIImage imageNamed:name];
    
    [tbc.view addSubview:imageView];
    
    [UIView animateWithDuration:3 delay:1 options:UIViewAnimationOptionCurveEaseIn animations:^{
        imageView.alpha = 0;
    } completion:^(BOOL finished) {
        [imageView removeFromSuperview];
    }];


    //应用图标显示数字
    // IOS8开始需要注册一下
    //[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil]];
    [UIApplication sharedApplication].applicationIconBadgeNumber = 10;
上一篇下一篇

猜你喜欢

热点阅读