ios 中的启动画面

Splash screen in ios

请建议我如何在 iphone 中创建闪屏一段时间。我已尝试通过创建新资源启动图像来更新 info.plist 但无法正常工作。 这个我试过了

#import "AppDelegate.h"
#import "SignIn.h"
#import "Splash.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    self.window=[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    Splash *splash=[[Splash alloc]initWithNibName:@"Splash" bundle:nil];
    self.window.rootViewController=splash;
    [self.window makeKeyAndVisible];
  sleep(3);
    SignIn *signIn=[[SignIn alloc]initWithNibName:@"SignIn" bundle:nil];
    self.window.rootViewController=signIn;
    return YES;
    }

添加您自己的带有图像视图的视图控制器,这也将帮助您对您的应用进行一些预处理,例如检查互联网连接、下载和保存每次在应用中所需的数据。

要在一段时间后自动显示视图控制器,请在您显示的初始屏幕控制器的 viewDidLoad 中添加 NSTimer

- (void)viewDidLoad
{

//NSTimer calling Method B
[NSTimer scheduledTimerWithTimeInterval:5.0f 
target:self selector:@selector(methodB:) userInfo:nil repeats:NO];
}

- (void) methodB:(NSTimer *)timer
{
//Present next view controller.
}