4-22 Learning Experience
Set the trailing view for each group
-(UIView *) TableView: (UITableView *) TableView viewforfooterinsection: (nsinteger) Section
Set each group of Head view
-(UIView *) TableView: (UITableView *) TableView viewforheaderinsection: (nsinteger) Section
Be sure to note:
when setting each set of head and tail view, be sure to set the head and tail height of each group, otherwise it will not be displayed, because those two methods will not perform
Set tail height per group
-(CGFloat) TableView: (UITableView *) TableView heightforfooterinsection: (nsinteger) Section
Set head height per group
-(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (nsinteger) Section
Enter edit mode, do not set default to No
tableview.editing = YES;
[TableView Setediting:yes Animated:yes];
//TableView Whether you can select
_tableview.allowsselection = NO;
// is it possible to select multiple
Tableview.allowsmultipleselection = YES;
// edit mode can be multi-select
tableview.allowsmultipleselectionduringediting = YES;
/* Set the type of edit mode, default to Uitableviewcelleditingstyledelete if not implemented
If [TableView Setediting:yes Animated:yes] is set, the cell cannot be slid to the right
To see the Delete button, to click on the left edit mode will appear the Delete button, swipe right to display only
Is the delete button, the added mode will only appear on the left side of the cell in the edit mode Yes case
*/
-(Uitableviewcelleditingstyle) TableView: (UITableView *) TableView Editingstyleforrowatindexpath: (Nsindexpath *) Indexpath
{
return uitableviewcelleditingstyledelete;
}
Although this proxy method is optional but not implemented, the Delete button with the right swipe will not appear
-(void) TableView: (uitableview *) TableView Commiteditingstyle: (Uitableviewcelleditingstyle ) Editingstyle Forrowatindexpath: (nsindexpath *) indexpath
{
if (Editingstyle = = Uitableviewcelleditingstyleinsert) {
NSLog(@ "454564");
}
}
When assigning an array, note that you cannot assign values directly, preferably by using the Arraywitharray: method to assign values between the array and arrays
For example
Nsarray *array1 = [Nsarray arraywithobjects:@ "La la la", @ "hahaha", @ "hehe hey", @ "Woo Woo", Nil];
Self.array1 = [Nsmutablearray arraywitharray:array1];
Nsarray allows the programmer to store any object in, what it is and what it is, and to force the type conversion when used.
For example:
Nsarray *myarray;
Nsarray *myarray2;
NSDate *adate = [NSDate distantfuture];
Nsvalue *avalue = [NSNumber numberwithint:5];
NSString *astring = @ "a string";
MyArray = [Nsarray arraywithobjects:adate, Avalue, astring, Nil];//3 object
Myarray2=[myarray arraybyaddingobject:@ "Test"];//4 Object
Arraybyaddingobject: Appends a new object to the current data and returns a new data object (the new Array object and the appended object, which are two different array objects).
4-23 Learning Experience