·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> IOS开发 >> storyboard

storyboard

作者:佚名      IOS开发编辑:admin      更新时间:2022-07-23

一,代码动态改写

1,一般程序启动就自动执行 main.storyboard

也可以在AppDelegate改写

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point for customization after application launch.

    

    //使用Storyboard初始化根界面

//    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

//    self.window.rootViewController = [storyBoard instantiateInitialViewController];

 

2,xib里调用storyboard

- (IBAction)loginBtnClicked:(id)sender {

    //点击登陆按钮后切换到storyboard界面

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

 

//    self.view.window.rootViewController = [storyboard instantiateInitialViewController];

//    [self PResentModalViewController:[storyboard instantiateInitialViewController] animated:YES];

    [self presentViewController:[storyboard instantiateInitialViewController] animated:YES completion:nil];

    

    [storyboard release];

}

 

3,storyboard调用storyboard

    1. - (IBAction)openStoryboard:(id)sender {
    2.     UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil];
    3.     [self presentModalViewController:[secondStoryboard instantiateInitialViewController] animated:YES];
    4. }

 

4.

push segue 

是将另一个视图控制器压入到导航控制器的栈中。它通常和导航视图控制器(navigation view controller)一起使用。
新压入的视图控制器会有一个回退按钮,可以退回来上一层

 

modal segue

跳转到vc

使用performSegueWithIdentifier來切換ViewController

http://luckfox.iteye.com/blog/1826416

 

custom自定义,很少用

 

参考:

http://iaiai.iteye.com/blog/1493956     可惜实例无法下载

5. static Cell()

static Cell用于cell 不多但每个cell都不一样列表很方便。

仅用于uitableviewcontroller,不可以用在tableview!!!

列子:http://my.oschina.net/plumsoft/blog/53886(包含kvc(实现类似代理的父子画面调用))

代码名: