Hello fellow programmers,
First, sorry for the long post. My question is rather simple, but I want to make sure you know what I\'m doing and I really don\'t want to
I have a RootViewController without an own view.
You can't have a UIViewController without a view. If you have the app will crash. When you initialize a UIViewController it automatically creates a UIView for you.
- (void)viewDidLoad
{
[super viewDidLoad];
..
self.mapviewController = [[UCMapviewController alloc] initWithDelegate:self];
self.view = self.mapviewController.view;
..
}
From what can I see here, you're actually setting the RootviewController's view to be the map view. This should be done by overriding the -(void)loadView
method of your controller and there you need to set the view:
-(void)loadView
{
self.mapviewController = [[UCMapviewController alloc] initWithDelegate:self]; //if you're not using ARC this should be autoreleased;
self.view = self.mapviewController.view;
}
When viewDidLoad
method is called there is no geometry set in any of the views of your controller. They are only initialized (implicitly or explicitly by -(void)loadView
) and viewDidLoad
is called just right after that. Geometry is setup at earliest in viewWillAppear:
method and the consecutive viewDidAppear:
method, so viewWillAppear:
is the earliest point you can have your actual frame/bounds of your views and in viewWillAppear:
method you should only execute some lightweight operations (like setting geometry, starting timers, subscribe observers, etc..).
You said you don't want to change your approach, but you need to design according to these rules.