UITableViewCell has a lot of attributes, but there are only a few common attributes encountered in normal development, so the following I put in my development project often used about cell attributes summary, for future use.
1. Disable the cell click event method:
cell.selectionStyle = UITableViewCellSelectionStyleNone; // This property is written in the cellForRowAtIndexPath: method;
\
2. Turn off the gray background effect after the cell is clicked:
[tableView deselectRowAtIndexPath:indexPath animated:YES]; // This property is written in the didSelectRowAtIndexPath: method;
\
3. Remove lines between cells:
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // This method removes all cell lines. If you want to remove a certain cell line, you need to customize the cell line
\
4. Empty the blank cell:
self.tableView.tableFooterView = [[UIView alloc] init]; Or the self. The tableView. TableFooterView = UIView. New;
5. Pure code sets the cell with the arrow on the right side of methods: cell. The accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Set cell with right arrow in XIB:
6. Set the title icon to the left of the cell.
cell.separatorInset = UIEdgeInsetsMake(0, 5, 0, 5);
UIImage *record = [UIImage imageNamed:@”record”];
cell.imageView.image = record;
7.XIB’s cell registration method (visual cell registration method) :
1. Import the header file and declare it.
2. Register the cell in the tableView initialization method.
3. Perform further operations in cellForRowAtIndexPath: method.
The specific steps are shown below (for example, in one of my projects) :
\
\
\