I'm creating a project with a Tab Bar Controller. First, I have 4 different Tab Bar items, each doing their own thing. On my last Tab Bar item, I have about 7 different buttons. When I click a button, it opens a new view, like image or webview. But I'm having trouble trying to open one because in most of the tutorials I saw, they opened views using 2 xib files. But with a Tab Bar Controller, it's difficult because I have different views on each Tab Bar items.
So how to open a view with a button 开发者_StackOverflow社区on a Tab Bar?
I think this will work for you -- make another .xib file and add the view you want on that. And use that viewController in the below command and this will not disrupt the previous view.This method is called in the method controlling action of the button that needs to be clicked-
[self presentModalViewController:yourViewController animated:YES];
and then cancel the view using the following method in the method that controls the cancel button -
[self dismissPresentViewModalViewControllerAnimated:YES]
in yourViewController
Thus you can change the view in this way!!
Hope it works for you and do communicate if any problem persists
You're not very clear but you could use a NavigationController inside of a TabBarController. This way, the view (where you have you're 7 buttons which open a different view) would be manage by the NavigationController and when you click on the button you could call something like that [self.navigationController pushViewController:webViewControllerOrSomethingElse animated:yesOrNo];
.
精彩评论