can list delegate methods , data source methods uitableview
?
are delegates , data sources methods same uitableview
?
//_______________________________________________________________________________________________________________ // represents display , behaviour of cells. @protocol uitableviewdelegate<nsobject, uiscrollviewdelegate> @optional // display customization - (void)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath; // variable height support - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath; - (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section; - (cgfloat)tableview:(uitableview *)tableview heightforfooterinsection:(nsinteger)section; // section header & footer information. views preferred on title should decide provide both - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section; // custom view header. adjusted default or specified header height - (uiview *)tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section; // custom view footer. adjusted default or specified footer height // accessories (disclosures). - (uitableviewcellaccessorytype)tableview:(uitableview *)tableview accessorytypeforrowwithindexpath:(nsindexpath *)indexpath __osx_available_but_deprecated(__mac_na,__mac_na,__iphone_2_0,__iphone_3_0); - (void)tableview:(uitableview *)tableview accessorybuttontappedforrowwithindexpath:(nsindexpath *)indexpath; // selection // called before user changes selection. return new indexpath, or nil, change proposed selection. - (nsindexpath *)tableview:(uitableview *)tableview willselectrowatindexpath:(nsindexpath *)indexpath; - (nsindexpath *)tableview:(uitableview *)tableview willdeselectrowatindexpath:(nsindexpath *)indexpath __osx_available_starting(__mac_na,__iphone_3_0); // called after user changes selection. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath; - (void)tableview:(uitableview *)tableview diddeselectrowatindexpath:(nsindexpath *)indexpath __osx_available_starting(__mac_na,__iphone_3_0); // editing // allows customization of editingstyle particular cell located @ 'indexpath'. if not implemented, editable cells have uitableviewcelleditingstyledelete set them when table has editing property set yes. - (uitableviewcelleditingstyle)tableview:(uitableview *)tableview editingstyleforrowatindexpath:(nsindexpath *)indexpath; - (nsstring *)tableview:(uitableview *)tableview titlefordeleteconfirmationbuttonforrowatindexpath:(nsindexpath *)indexpath __osx_available_starting(__mac_na,__iphone_3_0); // controls whether background indented while editing. if not implemented, default yes. unrelated indentation level below. method applies grouped style table views. - (bool)tableview:(uitableview *)tableview shouldindentwhileeditingrowatindexpath:(nsindexpath *)indexpath; // willbegin/didend methods called whenever 'editing' property automatically changed table (allowing insert/delete/move). done swipe activating single row - (void)tableview:(uitableview*)tableview willbegineditingrowatindexpath:(nsindexpath *)indexpath; - (void)tableview:(uitableview*)tableview didendeditingrowatindexpath:(nsindexpath *)indexpath; // moving/reordering // allows customization of target row particular row being moved/reordered - (nsindexpath *)tableview:(uitableview *)tableview targetindexpathformovefromrowatindexpath:(nsindexpath *)sourceindexpath toproposedindexpath:(nsindexpath *)proposeddestinationindexpath; // indentation - (nsinteger)tableview:(uitableview *)tableview indentationlevelforrowatindexpath:(nsindexpath *)indexpath; // return 'depth' of row hierarchies @end //_______________________________________________________________________________________________________________ // protocol represents data model object. such, supplies no information appearance (including cells) @protocol uitableviewdatasource<nsobject> @required - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section; // row display. implementers should *always* try reuse cells setting each cell's reuseidentifier , querying available reusable cells dequeuereusablecellwithidentifier: // cell gets various attributes set automatically based on table (separators) , data source (accessory views, editing controls) - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath; @optional - (nsinteger)numberofsectionsintableview:(uitableview *)tableview; // default 1 if not implemented - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section; // fixed font style. use custom view (uilabel) if want different - (nsstring *)tableview:(uitableview *)tableview titleforfooterinsection:(nsinteger)section; // editing // individual rows can opt out of having -editing property set them. if not implemented, rows assumed editable. - (bool)tableview:(uitableview *)tableview caneditrowatindexpath:(nsindexpath *)indexpath; // moving/reordering // allows reorder accessory view optionally shown particular row. default, reorder control shown if datasource implements -tableview:moverowatindexpath:toindexpath: - (bool)tableview:(uitableview *)tableview canmoverowatindexpath:(nsindexpath *)indexpath; // index - (nsarray *)sectionindextitlesfortableview:(uitableview *)tableview; // return list of section titles display in section index view (e.g. "abcd...z#") - (nsinteger)tableview:(uitableview *)tableview sectionforsectionindextitle:(nsstring *)title atindex:(nsinteger)index; // tell table section corresponds section title/index (e.g. "b",1)) // data manipulation - insert , delete support // after row has minus or plus button invoked (based on uitableviewcelleditingstyle cell), datasource must commit change - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath; // data manipulation - reorder / moving support - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)sourceindexpath toindexpath:(nsindexpath *)destinationindexpath; @end
Comments
Post a Comment