您的位置:首页 > 移动开发

为iOS App增加启动渐变效果

2014-02-16 23:24 519 查看
转自:http://blog.csdn.net/jasonblog/article/details/8029081

由于目前苹果没有支持该功能,所以只能自己在App启动后做一个过度效果:

[cpp] view
plaincopy

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

{  

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];  

    // Override point for customization after application launch.  

    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];  

    self.window.rootViewController = self.viewController;  

    [self.window makeKeyAndVisible];  

      

    UIImageView *splashScreen = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease];  

    splashScreen.image = [UIImage imageNamed:@"Default"];  

    [self.window addSubview:splashScreen];  

      

    [UIView animateWithDuration:1.0 animations:^{  

        CATransform3D transform = CATransform3DMakeScale(1.5, 1.5, 1.0);  

        splashScreen.layer.transform = transform;  

        splashScreen.alpha = 0.0;  

    } completion:^(BOOL finished) {  

        [splashScreen removeFromSuperview];  

    }];  

      

    return YES;  

}  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS