[英]What causes two UITableViewCells with the same autolayout constraints to behave differently?
[英]Two TableViews that have same prototype cell, constraints behave differently
我創建了兩個ViewController和兩個TableView。 然后,我將原型單元添加到一個TableView中,根據需要進行設置,將其復制到另一個TableView中,更改其類和標識符,並在ViewController中將其鏈接起來,該ViewController是每個數據源的委托。
問題是,感覺一個人表現良好,具有預期的約束,而步行一個則不然,但是我不知道為什么,因為它們在每個對象中都具有相同的屬性:
ViewControllers:
饋送
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = myFeedingTableView.dequeueReusableCellWithIdentifier("feedingcell", forIndexPath: indexPath) as! FeedingCell
cell.time.text = self.vremena[indexPath.row]
return cell
}
步行
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = myWalkingTableView.dequeueReusableCellWithIdentifier("walkingcell", forIndexPath: indexPath) as! WalkingCell
cell.time.text = self.vremena[indexPath.row]
return cell
}
CustomCell文件
每個都連接到其類
FeedingCell是喂養原型細胞的一類
WalkingCell是喂養原型細胞的一類
約束條件
和約束相同,如您在圖片上看到的。
這是提供不同結果和約束的圖像 :
通過更改TableView中的rowHeight設置來解決。 謝謝@SilentLupin
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.