У меня возникла проблема с моим проектом.
Каждый раз, когда я пытаюсь получить доступ к своему UINavigationController из Pressed UIViewController, я получаю «(null)» в качестве возврата.
Так вот мой проект структурирован:
1. AppDelegate.m initalises UINavigation Controller
2. UINavigation Controller starts with Welcome Page
3. Welcome Page Pushes New UIViewController on Button Press
4. UIViewController returns (null) when self.navigationController called
Хорошо, вот код, на моей странице приветствия я звоню так:
MyClass *theChatRoom = [[MyClass alloc] initWithNibName:@"ChatRoom" bundle:nil];
[theChatRoom setTitle:[unitCode text]];
[self.navigationController pushViewController:theChatRoom animated:YES];
Что отлично работает, это выдвигает новый View Controller.
Но тогда в MyClass.m:
@implementation MyClass
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
NSLog([NSString stringWithFormat:@"%@",self.navigationController]);
}
return self;
}
Возвращает (ноль)
Что я делаю не так?