【问题标题】:Splash screen in iosios中的闪屏
【发布时间】:2016-06-03 11:03:58
【问题描述】:

请建议我如何在 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;
    }

【问题讨论】:

标签: ios objective-c iphone splash-screen


【解决方案1】:

在您正在呈现的启动画面控制器的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.
}

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 如果我将新的视图控制器添加为根视图控制器,那么一段时间后它将如何自动移动或导航。
    • 正如 Rahul 所说,您可以设置计时器,或者如果必须在开始时进行一些检查,您可以这样做,然后切换到主视图控制器
    猜你喜欢
    • 2019-09-14
    • 2015-05-16
    • 1970-01-01
    • 2011-06-26
    • 2020-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-15
    相关资源
    最近更新 更多