1. The file has XIB or a subordinate stroybord: You can set tableview (content) and tableviewcell (style, image, identifier, accessory) in its uitableview to change its attributes, view the status.
2. encapsulate it into the format of sample. plist:
Nsstring * Path = [[nsbundle mainbundle] pathforresource: @ "sampledata" oftype: @ "plist"];
Nsarray * items = [[nsdictionary alloc] initwithcontentsoffile: path] objectforkey: @ "data"];
For (nsdictionary * dict in items ){
Basicitem * Item = [[basicitem alloc] init];
Item. Image = [uiimage imagenamed: [dict objectforkey: @ "image"];
Item. Text = [dict objectforkey: @ "place"];
Item. detailtext = [dict objectforkey: @ "country"];
[Self. Items addobject: item];
}
3. nsdictionary and nsarray can be used in combination:
Nsarray * object = [[nsarray alloc] initwithobjects: @ "red", @ "green", @ "white", @ "black", nil];
Nsarray * Key = [[nsarray alloc] initwithobjects: @ "one", @ "two", @ "three", @ "four", nil];
Nsdictionary * dict = [nsdictionary dictionarywithobjectsandkeys: object, @ "image", key, @ "title", nil];
For (ID key in dict ){
Nslog (@ "key: % @, value: % @", key, [dict objectforkey: Key]);
}
Uitableview data filling mode