关于storyBoard的小知识点

storyBoard确实能减少不少代码量,但是不利于核实代码,所以用的相对少一点

下面是怎么读取storyBoard的代码,及推出下个界面

 //第一种,如果当前的控制器视图是里面的一个视图,那么用这个

    UIStoryboard *storyBoard=self.storyboard;

    //第二种是在本地查找

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

 

    RegisterViewController *registerView=[storyBoard instantiateViewControllerWithIdentifier:@"RegisterViewController"];

    [self.navigationControllerpushViewController:registerView animated:YES];

    //第三种 通过segue完成push

    //这种在storyBoard里可以给它设定标示了,来查找,另外可以设定退出类型

    [selfperformSegueWithIdentifier:@"LoginToRegister"sender:self];

以后有什么问题继续补充

原文地址:https://www.cnblogs.com/lingzhiguiji/p/3540535.html