任何 iOS 应用程序启动时首先调用哪个方法和函数?
问问题
4385 次
6 回答
9
我想它的
int main(int argc, char *argv[])
在main.m
文件中
但出于实际目的,我认为您通常需要根据情况实现一些 UIApplicationDelegate 的方法:
application:didFinishLaunchingWithOptions:
applicationDidBecomeActive:
applicationWillEnterForeground:
于 2011-02-18T10:07:50.253 回答
4
如果 A View启动,那么它是:
- (void)viewDidLoad {}
如果一个应用程序启动它是:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
或者
- (void)applicationWillEnterForeground:(UIApplication *)application {
我认为您最好使用ViewDidLoad方法。
我希望我有所帮助!
于 2011-02-18T10:49:21.477 回答
2
实际上:
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
出现在:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
于 2014-02-10T17:13:57.350 回答
1
当应用程序启动时,首先调用 application:didFinishLaunchingWithOptions: 方法..
视图启动后
那时 viewDidLoad 被执行;
于 2012-04-03T06:04:23.127 回答
1
应用启动期间调用的第一个函数
int main(int argc, char *argv[])
应用启动期间调用的第一个方法
application(_:willFinishLaunchingWithOptions:)
UIKit 处理大多数应用程序启动任务。
1) The app is launched, either explicitly by the user or implicitly by the system.
2) The Xcode-provided main function calls UIKit's UIApplicationMain() function.
3) The UIApplicationMain() function creates the UIApplication object and your app delegate.
4) UIKit loads your app's default interface from the main storyboard or nib file.
5) UIKit calls your app delegate's application(_:willFinishLaunchingWithOptions:) method.
6) UIKit performs state restoration, which calls additional methods of your app delegate and view controllers.
7) UIKit calls your app delegate's application(_:didFinishLaunchingWithOptions:) method.
于 2019-09-21T14:37:02.677 回答
0
看看图片根据苹果文档
- (BOOL)应用程序:(UIApplication *)应用程序 willFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
之前被调用
- (BOOL)应用程序:(UIApplication *)应用程序 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
于 2016-03-25T09:55:02.960 回答