ios笔记(一)

main调用delegate,delegate的didfinishlaunchingwithoption  方法调用各个viewcontroller

1.didFinishLaunchingWithOption方法,当一个app载入完成后需要做一些什么事情,在这里,我们指定了哪个view被载入到windows中作为默认显示的view。

——相当于android中的manifest:

单个视图:

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.imageviewController = [[ImageViewController alloc] initWithNibName:@"ImageViewController" bundle:nil];
    self.window.rootViewController = self.imageviewController;//设置主视图为imageviewcontroller
    [self.window makeKeyAndVisible];
    return YES;

初始化window

初始化ImageViewController

把window的rootviewcontroller设置为ImageViewController

设置子视图:

self.switchViewController = [[BIDSwitchViewController alloc] initWithNibName:@"SwitchView" bundle:nil];
UIView *switchView = self.switchViewController.view;
[self.window addSubview:switchView];
将名为switchview的子视图加入到window中


你可能感兴趣的:(ios笔记(一))