IOS UITableView Proxy method

Source: Internet
Author: User

#pragma mark-table View
//Set the number of sections
-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView {
Return1;
}
//Set the number of rows per section
-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section {
Return[Dataarrylist Count];
}
//operate on each TableviewcellEach unit shown in the UITableView is aA UITableViewCell object whose initialization functionInitwithstyle:reuseidentifier:InTableView the rapid sliding of the process of sliding, frequentThe Alloc object is more time-consuming///, so it introducesThe reuse mechanism of cell
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath {
static nsstring* Cellidentifier = @ "cell";

uitableviewcell* cell = [TableView dequeuereusablecellwithidentifier:cellidentifier];
if (cell== nil) {
Cell= [[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];
}
cell.textlabel.text=[Dataarrylist ObjectAtIndex:indexPath.row];
return cell;
}

- (void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) Indexpath {
if (Editingstyle = =Uitableviewcelleditingstyledelete) {
[Self.dataarrylist RemoveObjectAtIndex:indexPath.row];
[TableView Deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];
}else if (Editingstyle = = Uitableviewcelleditingstyleinsert) {
[Self.dataarrylist InsertObject:@ "456" AtIndex:indexPath.row];
[TableView Insertrowsatindexpaths:[nsarray Arraywithobject:indexpath] Withrowanimation: Uitableviewrowanimationright];
// Create A new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}

//Set UITableView Line Indent
-(Nsinteger) TableView: (uitableview*) TableView Indentationlevelforrowatindexpath: (Nsindexpath *) indexpath{
Nsuinteger row =[Indexpath Row];
   ReturnRow
}
//Set the height of the cell row interval
-(cgfloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) indexpath{
Return60;
}
//Set the response event for the selected cell
-(void) TableView: (uitableview*) TableView Didselectrowatindexpath: (Nsindexpath *) indexpath{

}
//Set the action performed on the selected row
-(nsindexpath*) TableView: (UITableView *) TableView Willselectrowatindexpath: (Nsindexpath *) Indexpath
{
    nsuinteger row = [Indexpath row];
    return Indexpath;
}
// Set the Del button for the scrub cell to be processed in the deleted data
- (BOOL) TableView: (UITableView *) TableView Caneditrowatindexpath: (Nsindexpath *) Indexpath {
}
// edit state when deleting
- (void {
}

IOS UITableView Proxy methods

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.