I’m developing an iOS app that I want it to have more than 10 views. In Android, you must create a layout and then its Class. I’ve been trying to achieve this in XCode but I do not know how to do it…
The idea is to have a class for view so that every class manages its own view. What I’ve done so far is this:
1- Create a new Objective-C class named Overview and subclass UIViewController and then check Witch XIB for user interface.
2- To show that view I use: [[NSBundle mainBundle] loadNibNamed:@"Overview" owner:self options:nil];
3- And in the viewDidLoad I use this: self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"overview_portrait.jpg"]]; to change the background image
I can see the view but the background doesn’t change, and when I add buttons and I click them it throws error: -[ViewController push:]: unrecognized selector sent to instance 0x7427220
How can achieve what I want?
Thank you in advance!
you are showing the view but you are not loading its controller, that’s why the controller’s methods are not getting called. You have to create an instance of your controller class and push it from your current controller. Something like this: