初始屏幕问题

我正在构build一个应用程序。 对于初始屏幕,我刚刚将default.png放入资源文件夹,并将睡眠时间设置为AppDelegate.m。 直到这里工作正常,我的应用程序正在启动与启动屏幕给定秒。 现在我想改变翻转闪屏的ViewTransition。 我怎样才能做到这一点 ?

谢谢

用uiimageview添加一个视图,并将其图像设置为default.png。 在开始时加载这个视图。 当你启动屏幕卸载这个shuld是你查看,然后翻转它。

你不能用default.png做翻转过渡,尝试在窗口中添加一个带有该图像的视图,并将转换应用到该视图。

您不能使用deafult.png图像给Transition模式启动屏幕。使用splash图像创build另一个UIViewController,只需使用所需的Transition样式和时间closures此视图控制器即可。

启animation面加载后,只需将其replace为新的UIImageView并设置翻转过渡。

以上所有人都对两件事是正确的:

一世。 您不能将转换添加到Default.png ii。 你需要添加UIView(或UIImageView)以添加转换。

以下是一些示例代码供您使用:

AppDelegate.h

@interface AppDelegate: .... { ... @property (strong, nonatomic) UIImageView *splashView; ... @end 

AppDelegate.m

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { // fade Default.png into next screen self.splashView = [[UIImageView alloc] initWithFrame: CGRectMake(0, 0, self.window.frame.size.width, self.window.frame.size.height)]; // get the right image (does not work on simulator) if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) self.splashView.image = [UIImage imageNamed:@"Default.png"]; else { [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) self.splashView.image = [UIImage imageNamed:@"Default-Landscape.png"]; else self.splashView.image = [UIImage imageNamed:@"Default-Portrait.png"]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } if (self.splashView) { [self.window.rootViewController.view addSubview:self.splashView]; [self.window.rootViewController.view bringSubviewToFront:self.splashView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; self.splashView.alpha = 0.0; [UIView commitAnimations]; } return YES; 

}

注释

注意我是如何使用上面的setAnimationTransition:UIViewAnimationTransitionNone。 此外,您可以使用委托自定义(基本上从超级视图中删除splashView)一旦完成。