Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 启动屏幕问题_Iphone_Ios_Ipad_Splash Screen - Fatal编程技术网

Iphone 启动屏幕问题

Iphone 启动屏幕问题,iphone,ios,ipad,splash-screen,Iphone,Ios,Ipad,Splash Screen,我正在构建一个应用程序。对于初始屏幕,我刚刚将default.png放入resources文件夹,并将睡眠时间设置为AppDelegate.m。在这里它工作正常之前,我的应用程序将在给定的时间内启动启动屏幕。现在我想更改翻转启动屏幕的视图转换。我该怎么做 谢谢只需使用uiimageview添加一个视图,并将其图像设置为default.png。在开始时加载此视图。启动屏幕卸载后,这应该是您的视图,然后将其翻转。您无法使用default.png进行翻转转换,请尝试在窗口中添加具有该图像的视图,并将转

我正在构建一个应用程序。对于初始屏幕,我刚刚将default.png放入resources文件夹,并将睡眠时间设置为AppDelegate.m。在这里它工作正常之前,我的应用程序将在给定的时间内启动启动屏幕。现在我想更改翻转启动屏幕的视图转换。我该怎么做


谢谢

只需使用uiimageview添加一个视图,并将其图像设置为default.png。在开始时加载此视图。启动屏幕卸载后,这应该是您的视图,然后将其翻转。

您无法使用default.png进行翻转转换,请尝试在窗口中添加具有该图像的视图,并将转换应用于该视图。

您无法使用deafult.png图像为启动屏幕提供转换样式。使用启动图像创建另一个UIViewController,只需使用所需的转换样式和时间关闭此视图控制器

启动屏幕加载后。只需将其替换为新的UIImageView并设置翻转过渡。

以上所有人在两个方面都是正确的:

一,。无法将转换添加到Default.png 二,。为了添加转换,您需要添加UIView(或UIImageView)

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

AppDelegate.h AppDelegate.m }

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

@interface AppDelegate: .... {
...
@property (strong, nonatomic) UIImageView *splashView;
...
@end
- (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;