UITableViewCell contentView layoutSubviews 死循環

發現一個問題,當在UITableViewCell 的 layoutSubviews 中修改 contentView 的frame時會產生死循環。該問題只會出如今iOS8中,iOS7與iOS9均沒有問題。佈局

緣由:在iOS8中Cell 使用autoLayout,直接修改View的frame會致使layoutSubviews從新調用。循環

解決辦法:autolayout

1.在contentView 中添加自定義customView,修改customView的frame來調整cell中View的位置;layout

2.使用autolayout來修改contentView的佈局;view

相關文章
相關標籤/搜索