[英]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.