本文介绍了StoryBoard中的自定义UITableViewCell AutoLayout右对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想(实际上不是)将UIButton粘贴到UITableViewControllerUITableView中原型自定义UITableViewCell的右侧(边距)边缘.我定义了2个约束:尾随空格到:超级视图(内容视图)和顶端空格到:超级视图.不得不说,这在UIViewController中很好用.但是,当我在iPhone5模拟器上运行它时,我的UIButton不在可见区域内.我可以在高分辨率设备模拟器上找到它,但是它不应该在所有设备上都可见吗?我已经监督了AutoLayout教程(包括Stanford课程和HSE Swift课程)以及所有Google,但是却束手无策:(如果您能对UITableViewCell AutoLayout的这种特性睁开我的眼睛,那将是很棒的.非常感谢你!

All I want (actually not) is to stick UIButton to the right (margin) edge of the prototype custom UITableViewCell in UITableView in UITableViewController. I define 2 constraints: Trailing Space to: Superview (Content View) and Top Space to: Superview. Have to say that this works just fine in UIViewController. But when I run it on, for example, iPhone5 simulator my UIButton is out of the visible area. I can find it on high resolution device simulator, but shouldn't it be visible on all of them?I've overwatched AutoLayout tutorials (inc. Stanford Course and HSE Swift Course) and all the Google, but stuck tight :(It would be great if you could open my eyes on this UITableViewCell AutoLayout specificity. Thank you very much!

UPD:我现在正在遍历其中一个tut,并且UITableViewCell的行为与本教程中的操作不同(!).似乎单元格不再适合UITableView.我知道这看起来是一个非常新手的问题(实际上是我),但是它可以在Xcode7或新近更新的iOS9或其他版本中发布吗?

UPD: I'm walking through one of the tuts now and UITableViewCell behavior is not similar to as in the tutorial(!) It seems like cells are no longer fit in UITableView. I know it looks like very novice question (as I actually am), but can it be issue in Xcode7 or newly updated iOS9 or something?

推荐答案

您是否已在表视图上应用约束,即前导结尾&底部.

Have you applied constraint on your table view i.e leading trailing top & bottom.

这篇关于StoryBoard中的自定义UITableViewCell AutoLayout右对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 07:28