在iOS8上错误的tableview行高
问题描述:
我有UITableViewAutomaticDimension rowHeight的tableview。其中一个单元格包含固定高度的uview。在iOS8上错误的tableview行高
内部的视图的放置两个按钮,并在该视图的LayoutSubviews方法我使用代码
self.button1.layer.cornerRadius = self.button1.frame.size.height/2
舍该按钮。
在iOS9按钮被正确地呈现:
但是,在iOS8上的按钮不能正确呈现:
问题是什么?我必须如何设置约束才能在iOS8中正确呈现按钮?
这里小区的.xib文件:
答
试试这个
这一行添加到您的自定义单元格类
-(void)layoutSubviews
{
[super layoutSubviews];
self. button1.layer.cornerRadius = self. button1.frame.size. height/2;
self. button1.clipsToBounds = YES;
[self.contentView layoutIfNeeded];
}
答
这对我的作品。请尝试。
self.button1.layer.cornerRadius = self.button1.frame.size.height/2
self.button1.clipsToBounds = true
希望这将有助于周到,谢谢
你在哪里把cornerRadius设置代码?我建议你把它放在'layoutSubviews'' – binchik
你应该在视图中设置角半径会出现方法,并在它之前调用layoutIfNeeded –
按钮的高度是多少? –