Different practices for setting a separator line for a custom cell

Source: Internet
Author: User

1. Add a uiview to the cell, set the UIView height to 1, and set the left, bottom, and right constraints for this uiview.

2. You do not need to add any controls to the cell, overriding the cell's-(void) Setframe: (CGRect) Frame method

-(void) Setframe: (cgrect) frame{    1;    [Super Setframe:frame];} /* In this way, each cell's height is reduced by 1, the bottom will be vacated by a height of 1 clearance, the color of the gap is TableView background color. That is, the color of the separator line is the background color of TableView * /

3. Set the separator line style to empty by code

Self.tableView.separatorStyle = Uitableviewcellseparatorstylenone;

Different practices for setting a separator line for a custom cell

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.