开发者

Iphone UiNavigation controller types

开发者 https://www.devze.com 2023-03-18 06:34 出处:网络
In examples I have seen of UINavigationContoller and UITableView, switching to next view is usually triggered by tapping into that cell and pushing a different UIViewController on top of stack, but wh

In examples I have seen of UINavigationContoller and UITableView, switching to next view is usually triggered by tapping into that cell and pushing a different UIViewController on top of stack, but what I want is to switch to next view by pressing a next button in bottom of page, which I want it to load the same UITableViewController again but with different contents in each cell.

-Can I put that next button on bottom of page? and where -Can I 开发者_JAVA百科call the same controller (but showing different contents) and put on top of stack using the UINavigationController?

Because I want to be able to browse back previos pages.


You would generally do as you highlighted first and push a new UIViewController subclass onto the UINavigationController.

A UIViewController is supposed to manage one screens worth of content. If you plan on breaking that convention by presenting different information you are essentially going to have duplicated if statements to decide whether the user should be viewing the content from before or after the button was tapped.

UINavigationController's are good for hierarchal data where the content becomes more specific as you drill down. The UINavigationController will also manage the stack so that you can go to previous pages.

To achieve what you want to achieve (stated here) you should be using a UINavigationController with your custom subclass of UITableViewController when the user submits questions you receive your xml, parse it and then instantiate a new instance of your UITableViewController subclass and push it onto the stack.


You can add a button in the footer view of your table view. To achieve this have a look at tableView:viewForFooterInSection:. Then add an action to that button which allocs and inits the view controller with the new content and pushes it onto the stack.


Just make your UITableViewDatasource returning your number of rows plus one in the last section you have in –(NSUInteger)tableView:numberOfRowsInSection:. Set any content for that cell before returning it to the tableView.

Then only push a new UIVIewController, when the user touches that last cell. You could also make the delegate of the UITableView returning nil on :

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath for the cells you don't want the user select.

0

精彩评论

暂无评论...
验证码 换一张
取 消