嗨,我可以問我是否可以混合xib與故事板中的我的UIViewController
?就像他們在他們的文件所有者中共享一個控制器一樣,因爲我打算通過使用nib作爲expandedview來創建可展開的視圖,並且我想將一個值從nib文件傳遞到故事板中的UIViewController
。謝謝。UIViewController在與nib文件的故事板
1
A
回答
3
我不建議你從故事板混合廈門國際銀行和視圖控制器和他們掛鉤全部一起。 如果你想爲一個擴展視圖中添加一個UIView到您的視圖控制器,你可以做這樣的事情:
// Load the first view inside our xib from main bundle
UIView *view = [[NSBundle mainBundle] loadNibNamed:@"nib_name" owner:self options:nil][0];
// Define new X,Y to our view
float new_x_position = 0;
float new_y_position = 400;
view.frame = CGRectMake(new_x_position, new_y_position, CGRectGetWidth(view.frame), CGRectGetHeight(view.frame));
// UILabel inside our nib, '111' is the tag we set to our UILabel
UILabel *label = (UILabel*)[view viewWithTag:111];
// Add our view to the current view as a sub view
[self.view addSubview:view];
我希望我理解正確你。
0
在故事板,你不提供xibs,但如果你想使用它們從筆尖加載然後使用:
MyViewController *viewController = [[MyViewController alloc] initWithNibName:@"CustomDownloadedXib" bundle:nil];
+0
更好地使用「awakeAfterUsingCoder」 –
相關問題
- 1. 從故事板的文件/ NIB文件
- 2. UIViewController和UITabBarControllers與故事板
- 3. 訪問UIViewController的故事板
- 4. 故事板UIViewController與多個類
- 5. 從UIViewcontroller調用故事板
- 6. 現在有故事板可以使用多個nib文件嗎?
- 7. 的UIViewController不保持在故事板
- 8. 故事板與表RTE在NIB缺少tableview
- 9. 與條件故事板
- 10. 在UIViewController中加載一個nib文件
- 11. UIViewController不從故事板呈現
- 12. 從UIController開始故事板UIViewController
- 13. iOS故事板 - 重新使用UIViewController
- 14. UIViewController,故事板,無初始方法
- 15. 無法在包中加載NIB:'使用故事板時的NSBundle
- 16. 故事板文件丟失
- 17. NSArray與故事板
- 18. UISplitViewController與故事板
- 19. instantiateViewControllerWithIdentifier與故事板
- 20. Tabbar與故事板
- 21. UICollectionViewCell與故事板
- 22. iPhone:與故事板
- 23. UITpBarController在UISplitViewController與故事板
- 24. iAd在UITabBarController與故事板
- 25. 本地化與故事板 - 錯誤運動故事板基本文件夾時
- 26. 使用UIViewController加載nib文件
- 27. Swift 4:相當於以編程方式加載nib文件,沒有故事板?
- 28. 在iPad上編輯故事板文件
- 29. 在故事板
- 30. 在故事板
謝謝Idan我明白了你的觀點,但我怎麼能觸摸我的筆尖的元素?例如,我想更改我的筆尖UILabel – RonPelayo
好的,我編輯了我的答案,請檢查。 :-) –