Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Poy77

macrumors newbie
Original poster
Sep 5, 2010
18
0
I know that I can use UITableViewController to create main view with multiple subviews. I can't use it in my case. I have many button in the main view (UIView) and when someone would press a button, then it opens a subview (UIView).

I have tried to use similar solution than in table view but I got compilation error:
[[self navigationController] pushViewController:targetViewController animated:YES];
I have to also implement a back button, which would be very easy to implement in table view.

Shall I use initWithNibName each time the button is pressed? Could it work?
I looked many Apple's examples, but I didn't find similar solution.
 
I know that I can use UITableViewController to create main view with multiple subviews. I can't use it in my case. I have many button in the main view (UIView) and when someone would press a button, then it opens a subview (UIView).
I suspect you mean a main view with multiple detail / secondary views. Subviews are normally considered to be views that are contained within a view (i.e. not on a separate screen). And it's not the UITableViewController that is taking care of this. It's a UINavigationController.

I have tried to use similar solution than in table view but I got compilation error:
Code:
[[self navigationController] pushViewController:targetViewController animated:YES];
Well, that's the code. What's the error?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.