首页 > 学院 > 开发设计 > 正文

storyboard

2019-11-14 18:38:33
字体:
来源:转载
供稿:网友

一,代码动态改写

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.VEvb.com/blog/1826416

 

custom自定义,很少用

 

参考:

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

5. static Cell()

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

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

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

代码名:


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表