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;
网友评论