具有相同原型单元格的两个TableView,约束行为不同

问题描述:

我创建了两个ViewControllers和两个TableViews。然后我添加了原型单元格到一个TableView,根据我的需要设置它,将它复制到另一个TableView,更改它的类和标识符并在ViewController中链接它,它是每个数据源和代理的ViewController。具有相同原型单元格的两个TableView,约束行为不同

的问题是,将一种是表现良好,而具有约束预期,并且步行一个是没有,但我不知道为什么,因为他们在每个人的所有相同的属性:

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 
    } 

WALKING

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是类进料原型电池

约束

和约束是一样的,你可以看到o在图片中。

这里是图像提供不同的结果和约束: image

+0

你有没有设置自动尺寸?或者可能是表格或单元格的单元格/行高度不同。 –

+0

你为tableView设置rowHeight吗? – SilentLupin

+0

好吧rowHeight解决了这个问题。谢谢,完全忘了tableView的设置,只关注单元格 – NikolaM

在TableView中改变rowHeight的设置解决。谢谢@SilentLupin