Second week MVC pattern
C belongs to the bridge function between M and V. V and M are generally not directly connected and do not communicate directly.
Logic to create buttons for the navigation bar, the bottom bar, and the bottom bar
- Instantiate a Viewcontroller
- Instantiate a navigationcontroller and initialize it with the viewcontroller above.
- Set the title, Icon for Navigationcontroller
- After repeating the above steps to get enough quantity
- Instantiate a Tabbarcontroller
- Tabbarcontroller is actually an array, fill the array with the above Navigationcontroller
- Set the window's Rootviewcontroller to the Tabbarcontroller
Use the parent class to unify the same set of objects in different Viewcontroller
For example, 5 Viewcontroller need a background map, you can create a baseviewcontroller, which will write a unified background map settings. Then let these different viewcontroller inherit from this Baseviewcontroller, and then write the different parameters in these Viewcontroller respectively--subclasses can call the properties of the parent class directly, it should be noted that the properties of the parent class must be written in the .hin the file.
- (void)viewDidLoad { [super viewDidLoad]; self.title = @"Two"; self.bgImageView.image = [UIImage imageNamed:@"bg2"]; }
(ii) iOS app development combat