How to remove the split line in the group style of IOS UItableView, iosuitableview

Source: Internet
Author: User

How to remove the split line in the group style of IOS UItableView, iosuitableview

When you customize UItableView, when the selected style is Group, the split line is usually set to transparent. To remove the style, you only need to reset a BackgroundView to overwrite the original one.

// Cancel the split line

UIView * view = [[UIView alloc] init] autorelease];

[Cell setBackgroundView: view];

// Click Cancel

Cell. selectionStyle = UITableViewCellSelectionStyleNone;



IOS TableViewCell custom split line

The product design requires that the cell split line length not be the whole screen width, and the design requires that the split line is 2px (two), with different colors on and off. Implementation: Change the split line style to None tableView in UITableView. separatorStyle = response; custom UITableViewCell write-(void) drawRect :( CGRect) rect method-(void) drawRect :( CGRect) rect {CGContextRef context = Response (); context (context, [UIColor clearColor]. CGColor); CGContextFillRect (context, rect); // upper split line, CGContextSetStrokeColorWithColor (context, [UIColor colorWithHexString: @ "ffffff"]. CGColor); CGContextStrokeRect (context, CGRectMake (5,-1, rect. size. width-10, 1); // CGContextSetStrokeColorWithColor (context, [UIColor colorWithHexString: @ "e2e2e2e2"]. CGColor); CGContextStrokeRect (context, CGRectMake (5, rect. size. height, rect. size. width-10, 1 ));}

How to remove the cell border and background in the grouped style UITableView

_ TableView. backgroundView = nil.
The test shows that it is OK, but I don't know whether the previous version has backgroundView or not, so I 'd better add a judgment: if (mainTableView.
BackgroundView ){
MainTableView.
BackgroundView = nil;} if the type is UITableViewStylePlain, [UIColor clearColor] is still valid, which is strange!
Under normal circumstances, the grouped style (
UITableViewStyleGrouped
) UITableViewCell has borders. To remove borders, you can use:
UIView * tempView = [[UIView alloc] init] autorelease];
[Cell setBackgroundView: tempView];
In fact, it is very easy to set the backgroundView to an empty View, and then it is clean.

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.