无法在tableview中使用的自动布局约束 [英] Unable to use autolayout constraints in a tableview

查看:239
本文介绍了无法在tableview中使用的自动布局约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的表视图,但无法添加任何自动布局约束。控制拖不工作 - 没有约束出现,和建设者形式似乎不活跃,我不能设置任何值出现(见下文)。自动布局处处使整个项目,基本上每个视图。这是为什么?

I have this table view and am unable to add any autolayout constraints. The control drag doesn't work - no constraints show up, and the builder form seems inactive, I can't set any values in there (see below). Autolayout is enabled everywhere across the project, basically on every view. Why is that?

推荐答案

这是因为你选中的单元格或单元格内容的浏览。您只能到内容视图里面的观点约束补充。

It is because you selected cell or Content View in cell. You can add constrains only to views inside Content View.

更新

另外你可能无法添加约束来查看,如果这观点是顶级对象(不是父视图的孩子)。

Also you may not be able to add constraints to view if this view is top level object (is not a child of parent view).

更新2

您可以只UIViews及其子类添加自动布局约束。你的情况,你试图约束增加的UITextField位于内UINavigationItem(它不是UIView的子类)。

You can add auto layout constraints only to UIViews and their subclasses. In your case you try to add constrains to UITextField which is located inside UINavigationItem (it is not subclass of UIView).

在这里,你可以找到类似的问题,并回答它: iOS的自动布局和UIToolbar / UIBarButtonItems

Here you can find the similar issue and answer on it: iOS Autolayout and UIToolbar/UIBarButtonItems

这篇关于无法在tableview中使用的自动布局约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆