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

Bal*_*yal 8 objective-c uitableview ios

我有一个uiview里面的tableviewcell.当我用ios 8运行代码时,表格cell看起来很好并且工作正常.但是,当我尝试在ios 7中运行此代码时,表cell内容重叠在其他内容上cell.

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

附上Tableviewcell scrrenshot如下:

查看彼此重叠的内容

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

if(!self.customCell){
    self.customCell = [self.goalDetailsTableview dequeueReusableCellWithIdentifier:@"GoalDetailsCell"];
}

//Height of cell
float height = 360;
return height;
}
Run Code Online (Sandbox Code Playgroud)

提前致谢.

Bal*_*yal 2

我自己解决了这个问题。

当你在ios7中运行时,只需maskToBounds = YES在tableViewCell实现文件中设置即可。

- (void)layoutSubviews
{
    self.cardDetails.layer.masksToBounds = YES;
}
Run Code Online (Sandbox Code Playgroud)