#pragma mark-Data refresh operation-(Ibaction) Add {Add model data Jxwine *wine = [[Jxwine alloc] init]; Wine. Money =@ "20.5"; Wine. Name =@ "very good drink"; Wine. Image =@ "New_wine"; [Self. Winearray Insertobject:wine Atindex:0];[Self.winearray Addobject:wine];Tell TableView: The model data changed, refresh the table quickly [Self. TableView Reloaddata];} - (Ibaction) Remove {Delete model data [Self. Winearray Removeobjectatindex:0]; [Self. Winearray Removeobjectatindex:0];Tell TableView: The model data changed, refresh the table quickly [Self.tableview Reloaddata];} -(ibaction) update {//jxwinecell *cell = (Jxwinecell *) [ Self.tableview Cellforrowatindexpath:[nsindexpath indexpathforrow:0 insection:0]; //cell.detailTextLabel.text = @ "¥100"; //change model data jxwine *wine = self0]; Wine.money = @ "100" ; Jxwine *wine2 = self.winearray[1 ]; Wine2.name = @ "haha"; //told TableView: Model data changed, hurriedly refresh table [self .tableview Reloaddata];}
#pragma mark-Data refresh operation-(Ibaction) Add {Add model data Jxwine *wine = [[Jxwine alloc] init]; Wine. Money =@ "20.5"; Wine. Name =@ "very good drink"; Wine. Image =@ "New_wine"; [Self. Winearray Insertobject:wine Atindex:0]; Jxwine *wine2 = [[Jxwine alloc] init]; Wine2. Money =@ "100.5"; Wine2. Name =@ "very good"; Wine2. Image =@ "New_wine"; [Self. Winearray Insertobject:wine2 Atindex:0];RefreshNsarray *indexpaths = @[[Nsindexpath Indexpathforrow:0 Insection:0], [Nsindexpath Indexpathforrow:1 insection:0]]; [Self. TableView insertrowsatindexpaths:indexpaths withrowanimation:uitableviewrowanimationright];} - (Ibaction) Remove {Delete model data [Self. Winearray Removeobjectatindex:0]; [Self. Winearray Removeobjectatindex:0];RefreshNsarray *indexpaths = @[[Nsindexpath Indexpathforrow:0 Insection:0], [Nsindexpath Indexpathforrow:1 insection:0]]; [Self. TableView deleterowsatindexpaths:indexpaths Withrowanimation:uitableviewrowanimationmiddle];} - (ibaction) Update {Change model data Xmgwine *wine =Self. winearray[0]; Wine. Money =@ "100"; Xmgwine *wine2 =Self. winearray[2]; Wine2. Image =@ "New_wine"; Xmgwine *wine3 = self.winearray[ 3]; Wine3.image = @ "New_wine"; //local refresh nsarray *indexpaths = @[[ nsindexpath indexpathforrow:0 inSection: 0], [nsindexpath Indexpathforrow: 2 insection:0], [NSIndexPath Indexpathforrow:3 insection:0]]; [self.tableview reloadrowsatindexpaths:indexpaths Withrowanimation:uitableviewrowanimationleft];}
IOS UI Basics