presentModalViewController - UIToolbar below something invisible
I'm calling a UIViewController
and presenting it like this in a navigation-based project:
[self presentModalViewController:self.controller animated:YES];
On the top of the controller I have a UIToolBar
with 2 buttons which I created in the IB. Everything appears, but there is something invisible on the top of my UIToolBar
. I concluded that because if I click on one of the buttons, nothing happens. If I click on the very top (the bar where the time is), then the button is activated. The area where I click and nothing happens is the same as the navigation bar. If that's the case, how can I put my view over the nav开发者_如何学运维igation bar, so that the buttons on my toolbar are accessible?
Now I have it working properly! I have to call presentModalViewController
with a UINavigationController
and not my own controller, which is a subclass of UIViewController
. Here it is some code, in case it helps someone:
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.contr];
[self presentModalViewController:navController animated:YES];
[navController release];
And in the viewDidLoad, inside the controller:
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = cancelButton;
Simple:
yourView.userInteractionEnabled = NO;
精彩评论