简体   繁体   English

自动布局功能在Xcode的表格视图单元中不起作用?

[英]Auto-layout features not working in a table view cell in xcode?

I am making a simple app since I'm quite new to xCode. 由于我是xCode的新手,所以我正在制作一个简单的应用程序。 I have a table view which holds cells. 我有一个包含单元格的表格视图。 I've added constraints that I was hoping would dynamically change the width of the cell depending on the device (iphone vs iPad). 我添加了一些限制,我希望这些限制可以根据设备(iPhone与iPad)动态更改单元的宽度。 However, it doesn't seem to be working. 但是,它似乎不起作用。

I believe I've set all the necessary constraints, but I guess I must be missing some. 我相信我已经设置了所有必要的约束,但是我想我一定会缺少一些约束。

Here is an image of what I'm working with: 这是我正在使用的图像:

视图

And this is the problem, when I change the size of the device I'm working on, the labels in the cell don't resize themselves. 这就是问题所在,当我更改正在使用的设备的尺寸时,单元中的标签不会自行调整大小。

视图2

Here are the constraints I'm currently using: 这是我当前使用的约束:

约束条件

Any help would be appreciated, thanks. 任何帮助,将不胜感激,谢谢。

Most probably you haven't updated the frames after changing the size of the view controller 更改视图控制器的大小后,很可能尚未更新框架 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM