How to stop UITableView from clipping UITableViewCell contents in iOS 7

后端 未结 2 1383
醉话见心
醉话见心 2020-12-02 21:07

As I updated an app of mine from iOS6 to iOS7 I noticed that where in iOS6 cell content was allowed to cross outside of a cell when the clipsToBounds property is set to NO o

相关标签:
2条回答
  • 2020-12-02 21:23

    You may made chang in the tableview attributes inspector of Clip Subviews.

    enter image description here

    0 讨论(0)
  • 2020-12-02 21:36

    It looks like the view hierarchy changed slightly in iOS 7 for table view cells.

    You can try setting the clips to bounds on the contentView's superview:

    [cell.contentView.superview setClipsToBounds:NO];
    

    If you add the following to your sample code and run on ios7 vs ios6, you'll see there's an additional view between the cell view and content view:

    [cell.contentView.superview setClipsToBounds:NO];
    NSLog(@"%@", cell.contentView.superview);
    NSLog(@"%@", cell.contentView.superview.superview);
    NSLog(@"%@", cell);
    
    if (self.view.clipsToBounds) {
        NSLog(@"Master clips");
    } else {
        NSLog(@"Master no clip");
    }
    
    0 讨论(0)
提交回复
热议问题