IOS UI Basics 09

Source: Internet
Author: User

    • Data Update
      • Global Refresh
   #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];}          
    • Local Refresh
   #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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.