当任何Iphone应用程序执行时,首先调用哪种方法?
答案 0 :(得分:7)
我想它
int main(int argc, char *argv[])
<{1>}文件中的
但是出于实际目的,我认为你通常需要实现一些UIApplicationDelegate的方法,具体取决于具体情况:
main.m
答案 1 :(得分:4)
如果A 查看启动,则为:
- (void)viewDidLoad {}
如果应用启动,则为:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
或
- (void)applicationWillEnterForeground:(UIApplication *)application {
我认为你最好使用 ViewDidLoad 方法。
我希望我能帮忙!
答案 2 :(得分:2)
实际上是:
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
之前来了:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
答案 3 :(得分:1)
当应用程序启动时,首先应用程序:didFinishLaunchingWithOptions: 方法叫做..
启动视图后
那时执行viewDidLoad;
答案 4 :(得分: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.
答案 5 :(得分:0)
Have look at image 根据apple doc