以前不太使用xib和storyboard进行布局,后来在工作中参与到了一个项目的维护工作,那个项目就是使用stroyboard的,再加上xcode5对stroyboard的大力支持,就在这里对于使用stroyboard和xib的一些知识进行总结。
请参阅官方文档:
Using Unwind Segues
先说说segue,中文翻译为继续,这个东西,稍微有点Android的Intent的意思,但是它的功能很单一。
1. A UIStoryboardSegue
object is responsible for performing the visual transition between two view controllers. 就是负责storyboard中的controller的跳转用的。
2. You do not create segue objects directly. Instead, the storyboard runtime creates them when it must perform a segue between two view controllers. 不建议手动创建,会由storyboard自动创建。
3. You can still initiate a segue programmatically using the performSegueWithIdentifier:sender:
method of UIViewController
if you want. You might do so to initiate a segue from a source that was added programmatically and therefore not available in Interface Builder. 也可以手动建立segue,不用在interface builder中建立。
4. To use your custom segue, create a segue line between the appropriate view controllers in Interface Builder and set its type to Custom in the inspector; you must also specify the class name of the segue to use in the inspector.也可以在xib中使用自定义的segue,注意对类型。