简体   繁体   中英

Custom UITableViewCell Constraints not working

I have a nib that I load for a custom UITableViewCell that I added the missing constraints to in the bottom far right menu item that looks like this:

When I don't use auto constrains, it looks like this:

But when I click "Add Missing Constraints", it ends up like this:

I would like it so that the "Pts" label is a certain number of pixels from the right edge(so it aligns with the blue dashed margin line), but it never seems to work. Could anyone help me?

Select the label you want to constrain, click in the icon indicate in the pic bellow, select the right constrain line in the top the view where says add constrains, you add by clicking in the red line, enter the distance in point from the right margin you want (if you select constrain to margin it will use the blue lines you are taking about, if you uncheck it till count from the board of the frame. Select a top or button constrain as well, in the last dropbox select update frames and click add constraints. Done!

在此处输入图片说明

Here is an exemple of what the constrains look like

在此处输入图片说明

Also don't forget that now you can debug views in xCode using the button in the pic bellow

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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