隨着iOS8的發佈,我設計了我的表格視圖,利用細胞利用自調整細胞。但我需要我的桌子在iOS7中工作。我怎麼做?有沒有辦法在運行時檢查是否支持自定義大小的單元格,還是可以在控制器中實現一些不會在iOS7中調用的表委託方法?如何在iOS7上支持自定義大小的單元格?
如果我嘗試用自己上漿細胞iOS7我的表,我得到了控制檯上象這樣的錯誤:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7fc912d1d5a0 V:|-(>=11)-[UILabel:0x7fc912d13900] (Names: '|':UITableViewCellContentView:0x7fc912d13400)>",
"<NSLayoutConstraint:0x7fc912d1d6b0 V:[UILabel:0x7fc912d13900]-(11)-| (Names: '|':UITableViewCellContentView:0x7fc912d13400)>",
"<NSAutoresizingMaskLayoutConstraint:0x7fc912d24d80 h=--& v=--& V:[UITableViewCellContentView:0x7fc912d13400(0.5)]>"
)
你不能,iOS 7不支持iOS 8的自定義單元格。你將需要編寫一個'tableView:heightForRowAtIndexPath:'dat計算單元格的正確高度。 – rckoenes 2014-10-09 15:22:54
如果您需要支持iOS7,請勿使用自行調整功能。 – CrimsonChris 2014-10-09 15:22:55
我知道iOS7不支持自我尺寸測量單元。我的問題是如何處理爲iOS8設計的使用自調整大小的表格。例如。將tableView:heightForRowAtIndexPath:只能在iOS7上調用,而不是在iOS8上調用?總之,如何編寫適用於iOS7和iOS8的代碼? – 2014-10-09 15:34:33