我想在我的自定义单元格中有一个正确对齐的按钮。这样做的自动布局和设置一个水平空间从右边和对中它垂直没有显示按钮在我的单元格,因为它太远在右边。

在照片里你可以看到我的手机。但在实际的应用程序中却不是这样显示的。
编辑:我试过你的答案,但这似乎行不通。在模拟器中,我的TableView看起来有点奇怪:

我的控制器有问题吗?
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("eventCell", forIndexPath: indexPath) as EventTableViewCell
let event = items[indexPath.row]
cell.contentView.autoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
return cell
}发布于 2015-03-12 20:50:17
我是哑巴。我的细胞布局很好。我非常专注于单元格,以至于忘记向TableView添加约束。添加这些约束解决了问题。
发布于 2015-03-12 17:59:57
对该按钮执行以下操作:
Width and Height constraintshttps://stackoverflow.com/questions/29016730
复制相似问题