If you need to keep track of what is in Nsarray, you need to override the Descriptionwithlocal method. First create a new category for Nsarray, add the following code to the newly created. m file
-(NSString *) Descriptionwithlocal: (ID) Local
{
nsmutablestring *string = [nsmutablestring string];
[String appendstring:@ "("];
for (id obj in self) {
[String appendformat:@ "\n\t\"%@\ ",", obj];
}
[String appendstring:@ "\ n)"];
return string;
}
As a result, the data in the Nsarry is no longer utf-8 encoded in NSLog and is displayed as the original data.
UITableView
Need a data source to display the data
1. Need to join the data source protocol Uitableviewdatasource; <
2. Set the table group number-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView; <
3. Set the number of rows in each group-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (Nsinteger) Sectio n; <
4. Set the data content displayed in each group-(UITableViewCell *) TableView: (UITableView *) Tableviewcellforrowatindexpaht: (Nsindexpath * ) Indexpath {
UITableViewCell *cell = [[UITableViewCell alloc]initwithstyle:uitableviewcellstyledefault ReuseIndentifier:nil];
Indexpath.section is the group name
The cell is the data in the returned group.
5. Set the title of the group-(NSString *) TableView: (UITableView *) TableView titleforheaderinsection: (Nsintger) Secton; <
6. Set the title of the footer, sub-headings at the bottom of the group-(NSString *) TableView: (UITableView *) TableView titleforfooterinsection: (nsinteger) Section ; <
7. The dictionary returns all keys methods Nsarray *items = [Self.cities AllKeys]; < The order of the data out is messy.
8. Separate the groupings in the UITableView (that is, set the style, but the style can only be set at initialization time)
UITableView *tableview = [[UITableView alloc] Initwithframe:style: (Uitableviewstyle)]; <
9. Proxy method:-(void) TableView: (UITableView *) Tableviewdidselectrowatindexpath: (Nsindex *) indexpaht; <
Details determine success or failure!
iOS Learning Note (iii) TABLEVIEW