标签:ios 解决方案 uitableviewcell storyboard autolayout
最近在使用storyboard,在自定义Cell如下,
同样设置约束条件后,当没有accessoryView时,问题出现了,右侧label的位置发生了变化,而并非期望中的对齐。
琢磨许久,找到如下解决方案。
if (indexPath.row == 2 || indexPath.row == 4) {
    }else
    {
        //添加如下透明的accessoryView
        UIView *accessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 17, 15)];
        DLog(@"accessoryView w is %.2f", accessoryView.frame.size.width);
        DLog(@"accessoryView h is %.2f", accessoryView.frame.size.height);
        accessoryView.backgroundColor = [UIColor clearColor];
        cell.accessoryView = accessoryView;
    }OK!
解决storyboard下使用autolayout自定义Cell时,右侧不对齐的问题
标签:ios 解决方案 uitableviewcell storyboard autolayout
原文地址:http://blog.csdn.net/heartofthesea/article/details/45063117