Summary
This chapter is mainly modified on the basis of the previous chapter, change it to the example of the navigation controller, the other changes are not very
Run Results
Process Overview
- Create a new base view-based program, and then change the project based on the navigation controller by opening main.storyboary, selecting Viewctroller, and then eeditor->ebed In->nav in Xcode: To achieve the conversion
- To create a new class for level two pages, this example uses a Level two Page object, using the title and page background color as a distinction
- Slightly
Main code
#pragma uitableviewdelegate-(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) indexpath{ //Modify Sub-page information nsstring* cityname = [[Self._dictprovince objectforkey:[self._arraykeys Objectatindex : Indexpath.section]] objectAtIndex:indexPath.row]; Self._cityview.title = CityName; Self._cityview.view.backgroundcolor = [Uicolor colorwithred:arc4random ()%100/100.0f green:arc4random ()%100/100.0f Blue:arc4random ()%100/100.0f alpha:1.0f]; Navigate to the next Level page [Self.navigationcontroller pushviewcontroller:self._cityview animated:yes];}
Engineering Code
ios-use of the Navigation view controller