[英]add a custom uiview with xib in my storyboard
不能使用xib
的内部文件Storboard
文件。 因此,要么完全在Storyboard
创建视图,然后照常使用它即可。 或者,从xib
文件中添加视图,然后通过代码将一个subView
添加到storyboard
subView
上的视图。
所以在viewController
中是viewController
:
UINib *nibFile = [UINib nibWithNibName:@"SortableTableTitleView" bundle:nil];
NSArray *views = [nibFile instantiateWithOwner:self options:nil];
UIView *sortableTableTitleView = views[0]; //Assuming it is the only view in the xib file
//Add it where you want as a normal view now:
[self.view addSubview: sortableTableTitleView];
我意识到上面的代码在Objective-C中-当我得到差距时我会得到Swift的比较(对Swift和其他都是新手)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.