tableviewcell内的视图高度与ios 7和ios 8不同

前端之家收集整理的这篇文章主要介绍了tableviewcell内的视图高度与ios 7和ios 8不同前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在tableviewcell里面有一个uiview.当我使用ios 8运行代码时,表格单元格看起来很好并且工作正常.但是当我尝试在ios 7中运行此代码时,表格单元格内容与单元格的其他内容重叠.

任何人都可以帮我正确地做到这一点.

附上Tableviewcell scrrenshot如下:

  1. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3.  
  4. if(!self.customCell){
  5. self.customCell = [self.goalDetailsTableview dequeueReusableCellWithIdentifier:@"GoalDetailsCell"];
  6. }
  7.  
  8. //Height of cell
  9. float height = 360;
  10. return height;
  11. }

提前致谢.

解决方法

我自己解决了这个问题.

在ios7中运行时,只需在tableViewCell实现文件中设置maskToBounds = YES.

  1. - (void)layoutSubviews
  2. {
  3. self.cardDetails.layer.masksToBounds = YES;
  4. }

猜你在找的iOS相关文章