2014-08-28 84 views

回答

0

你可以这样做

YourViewController *aView = [[YourViewController alloc] 
           initWithNibName:@"xibName" bundle:nil]; 
[self presentViewController:aView animated:YES completion:nil]; 
+0

我想从UIView.UIView加载UIViewController没有presentViewController方法。 – Sofeda 2014-08-28 11:45:10

+0

比你可以这样做[yourViewObject addSubview:aView.view]; – Rajesh 2014-08-28 11:48:42

+0

在这种情况下,只有UIViewController.view可见。我需要ViewController作为rootviewController – Sofeda 2014-08-28 11:50:14

0

您可以使用NSNotification以通知的ViewController呈现另一个视图控制器。

点击此处了解详情:

NSNotificationCenter Class Reference

显示的视图控制器具有:

ViewController *viewController = ...; 

[self presentViewController:viewController animated:YES completion:NULL]; 

另一种选择是,从你的按钮调用委托。

+0

我想从UIView.UIView加载UIViewController没有presentViewController方法。 – Sofeda 2014-08-28 11:44:53

+1

是的,你应该通知带有NSNotification/Delegate的ViewController来呈现你的控制器。 – Matz 2014-08-28 12:14:40

+0

你是对的@Matz – Sofeda 2014-08-31 07:06:35

相关问题