iOS 7 UITableView: is it a bug or is it me?

后端 未结 4 891
故里飘歌
故里飘歌 2021-02-14 14:35

Please see the attached image. In table views in iOS 7, UIKit draws a thin gray vertical line between the accessory view and the reordering control. However, when the table view

相关标签:
4条回答
  • 2021-02-14 14:46

    I had the same issue and managed to find a work-around. The problem seems to happen when the table view is in editing mode and dequeues a cell which was queued while the table view was in non-editing mode. The work-around is to set the editing property of the cell to NO immediately after dequeuing it. The table view will set this property back to YES by itself after you return the cell in tableView:cellForRowAtIndexPath:.

    cell = [tableView dequeueReusableCellWithIdentifier:cellReuseIdentifier forIndexPath:indexPath];
    cell.editing = NO;
    
    0 讨论(0)
  • 2021-02-14 14:49

    I'm having the same issue on an iphone 6s plus and solved it setting the backgroundColor of the cell's textLabel to clearColor

    cell.textLabel.backgroundColor = [UIColor clearColor];
    

    Looking at my problem with reveal showed me that the right border of the label was drawing this vertical line.

    0 讨论(0)
  • 2021-02-14 15:05

    This works for Swift 2.1. on iOS 9.2.1. in XCode 7.2.: I tested the code on iPhone 6s, while on 4" devices the separator does not appear.

    I have made a subclass of UITableViewCell

    Inside of required init(coder aDecoder: NSCoder) I have done this:

    required init(coder aDecoder: NSCoder)
    {
        super.init(coder: aDecoder)!
        self.textLabel?.backgroundColor = UIColor.clearColor()
    }
    

    You might find the need to set the background color in override func drawRect(rect: CGRect) {} since this solution applies only to a cell create by Interface builder.

    The solution works on dev and simulator.

    0 讨论(0)
  • 2021-02-14 15:07

    You can try this using

    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
    {
        cell.backgroundColor=[UIColor clearColor];
        cell.backgroundView=nil;
    }
    

    this method might be helpful or something that might be in you cell like some image or what.? or you can check that using allocation of cell like this place if(cell==nil) instead if(1)and alloc cell eveytime

    0 讨论(0)
提交回复
热议问题