In my iPhone application, I use a Tab Bar Controller with five items for the main navigation. However, I also need additional ways to change the current view. For example, if the user is on the Calendar tab and clicks on a date, they need to be shown a different view.
In order to implement this (and other) types of custom navigation, what do I do? I thought what I needed was to add the Navigation Controller to my Main Window nib, but this looks like it adds a navigation bar to the UI, so I don't think that's it. Basically, what is the best way to change the view when a user clicks on something like a button or item on a grid? I know how to hook these interface items to events, but don't quite get how the logic to change views goes in the Main Window nib.
Thanks!
EDIT: To clarify, I believe what I'm trying to do is navigate to a child view for that tab (not change the active tab). As Griffo commented, yes, I am trying to assemble most of the workings in IB and then tweak the code as necessary. I will be trying the approach from his attached link and reporting back.
我认为这个问题可以回答您的问题
How about showing modal dialog? For instance if you have UIButton in your tab controller:
associate it with method:
[myButton addTarget:self action:@selector(onDoSomething:) forControlEvents: UIControlEventTouchUpInside];
in method -(void)onDoSomething:(id)_sender open your modal dialog:
[self presentModalViewController:mDoingsomethingController animated:YES];
implement "doing something" controller class and supply it with 'done' button and method 'onDone' containing
[self dismissModalViewControllerAnimated:YES];
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.