Integration of several solutions to tableView problems and tableview Solutions
Integration of recently encountered tableView problems. Some of them are idiots, but they are easy to learn ~
1. Concerning the left-side free 15 pixels of tableView;
2. about the problem of hidden redundant split lines in tableView;
3. There is a space between headercells in tableView;
4. Questions about select and Deselect.
1. Questions about the left-side free 15 pixels of tableView
There is always room on the left
Solution:
Call the leftLine method ~ The following method does not need to be called. It is a protocol method.
- (void)_leftLine { if ([_moreTableView respondsToSelector:@selector(setSeparatorInset:)]) { [_moreTableView setSeparatorInset:UIEdgeInsetsZero]; } if ([_moreTableView respondsToSelector:@selector(setLayoutMargins:)]) { [_moreTableView setLayoutMargins:UIEdgeInsetsZero]; }}- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; }
2. Questions about hidden redundant split lines in tableView
Sometimes the cell below is useless, but there are still split lines and hidden methods.
[tableView setTableFooterView:[[UIView alloc] init]];
There are a lot of methods, but this is the simplest in my opinion ~
3. There is a space between headercells in tableView.
What we want is:
However, the possible result is as follows:
This is because the style setting of tableView is incorrect. The former is UITableViewStylePlain, and the latter is UITableViewStyleGrouped.
Note that you should not select UITableViewStyleGrouped if there are many sections in tableView. UITableViewStyleGrouped is only a style for displaying tableView and has nothing to do with section.
4. Questions about select and Deselect
This problem is pure ~
Select and cancel the selection. The function is quite long,Careful and carefulOtherwise, once an error occurs, you cannot think of it as a hard task ~
The first two methods are from others' blog posts ~
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.