2015-07-12 75 views
2

我有一个自定义tableviewcell默认情况下标准披露指标垂直位于中心。如何在iOS邮件应用程序中垂直移动此标准披露指标?TableViewCell披露指标位置

enter image description here

+0

你不能改变披露指标的位置。只要在单元格中添加一个视图 –

+0

伊恩的答案允许它垂直移动。 –

回答

0

不能垂直移动标准披露指标。

如果你想实现这个功能,那么你需要使用你的自定义单元格,并使用披露指标的图像,然后你可以设置这个图像的按钮,你想放置在哪里。

或者您可以使用视图也可以作为一个辅助指标,并添加作为UITableViewCell

[cell.contentView addSubview:aView]; 

子视图你可以阅读更多在这里disclosure indicator

9

您可以调整子类的缺省附件的位置您的单元格,并在单元格的子视图(代表指示器)中找到UIButton并持有对其的引用。然后,您可以简单地在layoutSubviews更新accessoryButton的框架或任何你选择像这样:

class CellSubclass: UITableViewCell { 

    var accessoryButton: UIButton? 

    override func awakeFromNib() { 
     super.awakeFromNib() 
     accessoryType = .DisclosureIndicator 
     accessoryButton = subviews.flatMap { $0 as? UIButton }.first 
    } 

    override func layoutSubviews() { 
     super.layoutSubviews() 
     accessoryButton?.frame.origin.y = 8 
    } 
} 
0

您可以修改布局页边距,将在固定的.xib上TableViewCell然后将右边距为需要的值。