2014-08-28 3 views

ответ

0

Вы можете сделать как этот

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

Я пытаюсь загрузить UIViewController из UIView.UIView не имеет метода presentViewController. – Sofeda

+0

Чем вы можете это сделать [yourViewObject addSubview: aView.view]; – Rajesh

+0

В этом случае видно только UIViewController.view. Мне нужен ViewController как rootviewController – Sofeda

0

вы могли бы использовать NSNotification информировать ViewController для представления другого ViewController.

Более подробная информация здесь:

NSNotificationCenter Class Reference

Показать ViewController с:

ViewController *viewController = ...; 

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

Другой вариант заключается, вызов делегата от вашей кнопки.

+0

Я пытаюсь загрузить UIViewController из UIView.UIView не имеет метода presentViewController. – Sofeda

+1

Да, вы должны сообщить ViewController с NSNotification/Delegate, чтобы представить ваш контроллер. – Matz

+0

Вы правы @Matz – Sofeda

Смежные вопросы