2012-04-04 63 views
1

我的客户希望他的飞溅图像淡出,然后显示UI。我不知道如何做到这一点。截至目前它刚刚出现一次它加载。有没有简单的方法来做到这一点?iOS 5飞溅页面转换

回答

3
UIImageView *splash=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"splash"]]; 
[UIView animateWithDuration:1 
       animations:^{ 
        splash.alpha = 0.0; 
       } 
       completion:^(BOOL finished) 
{ 
    [splash release]; 
}]; 
1

我一直在寻找这个教程,但决定不来实现它,所以我不能担保其是否工作或没有,但一切看起来都在检查

http://www.dobervich.com/2010/10/22/fade-out-default-ipad-app-image-with-proper-orientation/

要小心的是增加了很多你的应用程序启动是应用程序拒绝的理由。

避免显示关于窗口或启动画面。通常,请尝试使用 以避免提供任何类型的启动体验,以防止人们立即使用您的应用程序。

来源:Apple Developer Site

1

正如我在closely related question刚才解释,不要使用闪屏!请将此与您的客户联系起来,他们可能不熟悉人机界面指南。这就是说,如果你不能说服你的客户,否则,你可以淡出UIImageView,我在我的另一个回应中提到。

1

您可以实现自己的UIViewController作为一个闪屏:

@interface SplashScreenViewController : UIViewController { 
    UIImageView *splashView; 
} 

@end 

//

#import "SplashScreenViewController.h" 

@implementation SplashScreenViewController 

#pragma mark - View lifecycle 

- (void)loadView { 
    self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; 

    splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 
    [splashView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; 
    [self.view addSubview:splashView]; 
} 
- (void)viewWillAppear:(BOOL)animated { 
    if (isIPad) { 
     if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) 
      splashView.image = [UIImage imageNamed:@"Default-Portrait~ipad.png"]; 
     else 
      splashView.image = [UIImage imageNamed:@"Default-Landscape~ipad.png"]; 
    } 
    else 
     splashView.image = [UIImage imageNamed:@"Default.png"]; 
} 
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
    if (isIPad) { 
     if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) 
      splashView.image = [UIImage imageNamed:@"Default-Portrait~ipad.png"]; 
     else 
      splashView.image = [UIImage imageNamed:@"Default-Landscape~ipad.png"]; 
    } 
} 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return (isIPad ? YES : UIInterfaceOrientationIsPortrait(interfaceOrientation)); 
} 

@end 

然后,显示后,可以隐藏这个UIViewController你想要的任何过渡。