我在Interface Builder中創建了一個UIView。我有一個按鈕。我可以通過點擊UIView按鈕加載應用程序中的任何ViewController?我的UIView不在導航控制器下。從UIView(.xib)加載UIViewController按鈕操作
0
A
回答
0
你可以這樣做
YourViewController *aView = [[YourViewController alloc]
initWithNibName:@"xibName" bundle:nil];
[self presentViewController:aView animated:YES completion:nil];
0
您可以使用NSNotification以通知的ViewController呈現另一個視圖控制器。
點擊此處瞭解詳情:
NSNotificationCenter Class Reference
顯示的視圖控制器具有:
ViewController *viewController = ...;
[self presentViewController:viewController animated:YES completion:NULL];
另一種選擇是,從你的按鈕調用委託。
相關問題
- 1. 如何將UIView XIB「導入」UIViewController XIB?
- 2. 重新加載UIViewController和xib
- 3. 無法從UIViewController加載xib文件
- 4. 如何從UIView訪問UIViewController的按鈕?
- 5. 從Xib加載的自定義UIView
- 6. 無法從UIViewController添加UIView
- 7. 如何在uiview中加載xib?
- 8. 從UIView推UIViewController
- 9. 在操作按鈕上錄製時在視圖控制器中加載UIView
- 10. 用xib向UIViewController添加一個UIView子類
- 11. ECSlidingViewController從XIB加載
- 12. 自定義UIView鏈接到UIViewController - 如何處理按鈕動作
- 13. UIViewController不加載我的自定義UIView
- 14. iPhone添加(+)按鈕操作?
- 15. 添加UIview到UIViewController
- 16. 如何在單擊按鈕時將UIView作爲UIViewController的子視圖添加?
- 17. 從Xib加載的UIView中的UIButton在您點擊
- 18. 如何通過父XIB將UIView從XIB子通信到UIView?
- 19. 使用UIView作爲按鈕
- 20. 無法從XIB加載Cell
- 21. 從XIB加載NSView子類
- 22. UIViewController無法正確載入它的xib
- 23. 將uiview添加到uiviewcontroller
- 24. 添加的UIView上的UIViewController
- 25. 將UIView添加到UIViewController
- 26. iPhone - 加載一個新的UIView上按下按鈕
- 27. UIAlertView按鈕操作?
- 28. 爲什麼它是UIView而不是UIViewController的子類xib中的UIViewController?
- 29. 從UIView到UIViewController的UIImage
- 30. 無法從UIViewController訪問UIView
我想從UIView.UIView加載UIViewController沒有presentViewController方法。 – Sofeda 2014-08-28 11:45:10
比你可以這樣做[yourViewObject addSubview:aView.view]; – Rajesh 2014-08-28 11:48:42
在這種情況下,只有UIViewController.view可見。我需要ViewController作爲rootviewController – Sofeda 2014-08-28 11:50:14