UITableViewCell contentView layoutSubviews 死循环

发现一个问题,当在UITableViewCell 的 layoutSubviews 中修改 contentView 的frame时会产生死循环。该问题只会出现在iOS8中,iOS7与iOS9均没有问题。

原因:在iOS8中Cell 使用autoLayout,直接修改View的frame会导致layoutSubviews重新调用。

解决办法:

1.在contentView 中添加自定义customView,修改customView的frame来调整cell中View的位置;

2.使用autolayout来修改contentView的布局;

原文地址:https://www.cnblogs.com/dokaygang128/p/5031103.html