I am currently developing an iPhone App for my company and i ran into a strange thing.
My View Hierachy looks like this:
UITabBarController containing 5 Tabs with every Tab containing a UINAvigationController. So far everything works perfect.
Now i want to present a modal View controller via the presentModalViewController method on the UITabBarController using this lines of code:
-(void)callFilterOptions
{
FilterOptionsView *filterView = [[FilterOptionsView alloc] init];
[filterView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.tabBarController presentModalViewController:filterView animated:TRUE];
}
The FilterOptionsView is a normal UIViewController containing nothing but a black background at the moment.
What happens is that the view is presented and after a couple of seconds misteriously disappears. Why is this happening? At no Point i am calling the dismissModalViewController method.
I already ran into this problem when presenting a mailcomposer.
greetings, Florian
UINavigationController *myNavController = [self navigationController];
[myNavController presentModalViewController:filterView animated:TRUE];
or a better approach might be:
UIApplication *myApp = [UIApplication sharedApplication];
noIBAppDelegate*appDelegate = (noIBAppDelegate*)myApp.delegate;
[appDelegate.tabBarController presentModalViewController:filterView animated:YES];
to dismiss:
UIApplication *myApp = [UIApplication sharedApplication];
noIBAppDelegate*appDelegate = (noIBAppDelegate*)myApp.delegate;
[appDelegate.tabBarController dismissModalViewControllerAnimated:YES];
ps I recommend not naming a view controller "filterView" it would be better named "filterViewController"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.