The holes we met in IOS those years

Source: Internet
Author: User

1 Pit: The first cell of the UITableView moves down

Cause: IOS7 and later versions, if Uiscrollview is the first child of its parent view, the offset is automatically added. UITableView inherit from Uiscrollview, so there is an offset.

Workaround: Add an empty view as the first child view of the parent view. (Place the desired scrollview below the empty view as the second child view)

UIView *view = [[UIView alloc] init];
[Scrollview.superview Addsubview:view];

If you specify the distance between the first cell and the top edge of the UITableView, you can:

Tableview.contentinset = Uiedgeinsetsmake (40, 0, 0, 0);

The holes we met in IOS those years

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.