关于StoryBoard的一些小常识

知识点一:

要想在用Storyboard创建的视图控制器之间实现来回跳转,必须使用一下方法:

第一步:先从整个工程中包中找到视图所在的StoryBoard,举例:

UIStoryBoard *storyboard = [UIStoryBoard storyboardWithName:@“Main” bundle:[NSbundle mainbundle]];

第二步:从工程包中获取的storyboard中,根据视图控制器的“storyboard ID”属性找到对应的视图。举例:

ThiredViewController*third = [storyboard instantiateViewControllerWithIdentifier:@“Detail"];

知识点二:

- (void)prepareForSegue:(UIStoryboardSegue*)segue sender:(nullableid)senderNS_AVAILABLE_IOS(5_0);

// View controllers will receive this message during segue unwinding. The default implementation returns the result of -respondsToSelector: - controllers can override this to perform any ancillary checks, if necessary.

知识点三:

通过从Xib中初始化一个对象 原文:http://www.cnblogs.com/johnc/p/4244981.html

//  第一步:先找到XIb文件对应的数组(因为每个XIb文件包含很多个控件,所以需要用数组来存储xib中的Elements)。

// Instantiate the nib content without any reference to it.

NSArray*nibContents = [[NSBundlemainBundle] loadNibNamed:@"EPPZPlainView"owner:niloptions:nil];

//  第二步:从数组中取出对应元素(视图)

// Find the view among nib contents (not too hard assuming there is only one view in it).

UIView *plainView = [nibContents lastObject];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容