Integration of several solutions to tableView problems and tableview Solutions

Source: Internet
Author: User

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.

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.