知识点一:
要想在用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];