Today Liu Guobin teacher told how to get the text through the path, then parse the text content, finally displayed to the page, using the time of the day to teach you how to use the Xib type of graphical editing custom cell to achieve the cell standard we want. Use the recipe demo how to write, and how to get pictures on the Internet.
If you request data from the Internet, you need to select Open as in the Info.plist configuration file and select Soure code to add a piece
NSData *data=[nsdata Datawithcontentsofurl:[nsurl URLWithString:menu.image];
Override the SetMenu method, where the menu property is the object created by the menu class. The menu class has its own six properties, so you can point it out on the right side of the equal sign, the equal sign to the left is the cell itself six properties, so in the main function to assign a custom cell's menu property, it will automatically call its own set method/This program in the main function to assign a value to the Menu property, Because there are only six properties of the NSString type in the menu class, the assignment is to pass the contents of the array, which is an array of previously prepared strings
-(void) SetMenu: (Menu *) menu{
_menu=menu;
Self.nametable.text=menu.name;
SELF.TAGTEXT.TEXT=MENU.TAGP;
Self.introducettxt.text=menu.introduce;
Self.materioltext.text=menu.materiol;
self.burdentext.text=menu.burdening;
If you request data from the Internet, you need to select Open as in the Info.plist configuration file and select Soure code to add a piece
NSData *data=[nsdata Datawithcontentsofurl:[nsurl URLWithString:menu.image];
Self.imagetable.image=[uiimage Imagewithdata:data];
}
Get text content
Self.imagetable.image=[uiimage Imagewithdata:data];
NSString *path=[[nsbundle mainbundle]pathforresource:@ "recipe text" oftype:@ ""];
NSString *strings=[nsstring Stringwithcontentsoffile:path encoding:nsutf8stringencoding Error:nil];
Nsarray *lines=[strings componentsseparatedbystring:@ "\ n"];
For (NSString *lin in lines) {
Nsarray *content=[lin componentsseparatedbystring:@ "&"];
Menu *men=[menu New];
MEN.NAME=CONTENT[0];
MEN.TAGP=CONTENT[1];
MEN.INTRODUCE=CONTENT[2];
MEN.IMAGE=CONTENT[3];
MEN.MATERIOL=CONTENT[4];
MEN.BURDENING=CONTENT[5];
[Self.menus Addobject:men];
Lan Yi iOS learning TableCell recipe Exercises