AutoLayout在IOS7上的cell那点事

    在最近的项目中使用了AutoLayout,因为,新项目要求从IOS7开始支持。

    在HeadView中使用,没有任何问题,而到了UITableViewCell的时候,发现在IOS7上会不显示,甚至奔溃。Google后,发现IOS6,8上也没有问题,只有在7上有这个问题。

    网上给出的解决方法,基本就是这样的。

self.contentView.frame = self.bounds;//或者 <span style="font-family: Arial, Helvetica, sans-serif;">self.contentView.bounds = CGRectMake(0, 0, 99999, 99999);</span>
self.contentView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin |UIViewAutoresizingFlexibleTopMargin |UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;

我尝试使用这个方法,还是不行。

最后的解决方法是,根据版本号布局。

你可能感兴趣的:(AutoLayout在IOS7上的cell那点事)