Reputation: 1
As part of my updating my apps to replace the deprecated presentModalViewController with presentViewController, I did some testing. What I found was disturbing. Whereas presentModalViewController always works and there is no question about it working, I have found the presentViewController method often will not display my VC at all. There is no animation and it never shows up. My loadView are called without problems, but the actual view does not appear.
So here is what I am doing:
My button-pressed callback is as follows:
- (void) buttonTapped: (id) sender {
VC *vc = [[VC alloc] init];
[self presentViewController: vc animated:YES completion: nil];
[vc release];
}
Here is my loadview in the VC class:
- (void) loadView {
UIView *v = [UIView new];
self.view = v;
[v release];
... create and addsubview various buttons etc here ...
}
Thanks.
Upvotes: 0
Views: 1303
Reputation: 953
Make sure the controller that calls the function has its view currently displayed (or is a parent to the one currently displayed) and it should work.
Upvotes: 2