美文网首页
iOS-界面淡化效果

iOS-界面淡化效果

作者: 亦晴工作室 | 来源:发表于2016-08-25 11:08 被阅读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;

相关文章

网友评论

      本文标题:iOS-界面淡化效果

      本文链接:https://www.haomeiwen.com/subject/vbkosttx.html