IOS7 iOS8 tableview separatorinset cell split line left justified

Source: Internet
Author: User

IOS7 and iOS8 in the TableView cell division line left-aligned method is not the same, hereby for later need to take notes.

IOS7 method is very simple, only need to set _table.separatorinset = Uiedgeinsetsmake (0, 0, 0, 0);

The IOS8 method needs to write a piece of code:

-(void) Viewdidlayoutsubviews {    if ([_table respondstoselector: @selector (setseparatorinset:)]) {        [_table Setseparatorinset:uiedgeinsetszero];    }    if ([_table respondstoselector: @selector (setlayoutmargins:)])  {        [_table Setlayoutmargins:uiedgeinsetszero ];    }} -(void) TableView: (UITableView *) TableView Willdisplaycell: (UITableViewCell *) cell Forrowatindexpath: (Nsindexpath *) indexpath{         if ([Cell respondstoselector: @selector (setlayoutmargins:)]) {           [cell setlayoutmargins: Uiedgeinsetszero];       }       if ([Cell respondstoselector: @selector (setseparatorinset:)]) {            [cell Setseparatorinset:uiedgeinsetszero];       }    }

  

IOS7 iOS8 tableview separatorinset cell split line left justified

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.