PDA

View Full Version : How do I make it push another view?




nomar383
Feb 19, 2009, 06:05 PM
I have a root view controller which (right now) pushes to one other view controller when a cell is selected. That's fine for my first 4 cells in the root view controller. But, for cell 5 I want it to push to a second view controller to display the "credits" for my app. How should I do this?



jnic
Feb 20, 2009, 04:20 AM
I have a root view controller which (right now) pushes to one other view controller when a cell is selected. That's fine for my first 4 cells in the root view controller. But, for cell 5 I want it to push to a second view controller to display the "credits" for my app. How should I do this?

Are you implementing UITableViewDelegate (https://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html)? If so you can just add a check in tableView:didSelectRowAtIndexPath: to see if the selected row was == 5.

nomar383
Feb 20, 2009, 11:30 AM
No worries, I figured it out. Just an if statement in my appdelegate to determine whether the index path was != 4 or == 4.

Another question though, say I have a table view for my root view controller, then I push to another table view. If I wanted to push to a third table view from there, would my appdelegate by doing the lifting, or would my latest view controller? I haven't been able to find an example online of someone with three table views, one after the other...

dejo
Feb 20, 2009, 11:53 AM
I haven't been able to find an example online of someone with three table views, one after the other...
Check out the sample app DrillDownSave (http://developer.apple.com/iphone/library/samplecode/DrillDownSave/index.html).

nomar383
Feb 20, 2009, 01:14 PM
Check out the sample app DrillDownSave (http://developer.apple.com/iphone/library/samplecode/DrillDownSave/index.html).

Thank you! I knew I had seen that somewhere before! And it makes way more sense than what I was doing :) lol