Little knowledge about UITableView

Source: Internet
Author: User

Typedef enum {
UITableViewCellSelectionStyleNone,
UITableViewCellSelectionStyleBlue,
UITableViewCellSelectionStyleGray
} UITableViewCellSelectionStyle
// Cell button format on the right
Typedef enum {
UITableViewCellAccessoryNone, // don't show any accessory view
UITableViewCellAccessoryDisclosureIndicator, // regular chevron. doesn't track
UITableViewCellAccessoryDetailDisclosureButton, // blue button w/chevron. tracks
UITableViewCellAccessoryCheckmark // checkmark. doesn' t track
} UITableViewCellAccessoryType
// Whether to add a line break
Typedef enum {
UITableViewCellSeparatorStyleNone,
UITableViewCellSeparatorStyleSingleLine
} UITableViewCellSeparatorStyle // change the line feed color

 

1. After clicking a cell, the system will enter another View and return to the top of the original View. How can we return the position before clicking?

NSIndexPath * ip = [NSIndexPath indexPathForRow: row inSection: section];

[TopicsTable selectRowAtIndexPath: ip animated: YES scrollPosition: UITableViewScrollPositionNone];

2. Select the Cell to respond to the event

-(Void) tableView :( UITableView *) tableView didSelectRowAtIndexPath :( NSIndexPath *) indexPath {

[TableView deselectRowAtIndexPath: indexPath animated: YES]; // The selected return color disappears instantly

}

3. In a program, sometimes users do not want to click a line. You can do this:

-(NSIndexPath *) tableView :( UITableView *) tableView willSelectRowAtIndexPath :( NSIndexPath *) indexPath {

NSUInteger row = [indexPath row];

If (row = 0) return nil; // prevents the first row from being selected

Return indexPath;

}

4. Move the cell to check whether the del button appears.

-(BOOL) tableView :( UITableView *) tableView canEditRowAtIndexPath :( NSIndexPath *) indexPath {

}

5. Editing status

-(Void) tableView :( UITableView *) tableView commitEditingStyle :( UITableViewCellEditingStyle) editingStyle forRowAtIndexPath :( NSIndexPath *) indexPath {

[TopicsTable setContentSize: CGSizeMake (0, controller. promiseNum * 44)];

}

6. Add an index table to the right

-(NSArray *) sectionIndexTitlesForTableView :( UITableView *) tableVIew {

 


}

7. Return the TITLE section.

-(NSString *) tableView :( UITableView *) tableView titleForHeardInSection :( NSInteger) section {

}

 

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.