4-23 Learning Experience

Source: Internet
Author: User

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

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.