AutoLayout shortcuts crop to the right side of the screen

I am trying to use automatic layout for a custom table view pane in my application.

I can't seem to hide the restrictions.

I laid out the shortcuts in the custom table view cell, but the labels are still cropped. Any ideas?

Thanks! Put everything you need. I tried to show the necessary information in the picture below:

Debugging in Xcode. Something that shows in Simulator looks different than when debugging Xcode.

Here is the width of my TableView: enter image description here

UPDATE: The problem here was related to what the user matt said in the accepted answer, but I wanted to make Q & A a little clearer, now that I found out for someone else this is happening.

In his initial comment, he mentioned the debugging of Xcode View, and that was great, and I was able to delve into a bit more. It is called an assistant editor: a device preview, where you can see the layout and layers of what is on the screen to see, perhaps you have shortcuts that overlap or exit the screen based on the device on which it works. If you want to check several sizes of the device, just click the plus sign in the lower left corner of this image. enter image description here

This helped me find overlapping layers and problems with the size of the TableView. I was able to see how it looks for each size of the device.

Which also sometimes helps to use the Pin menu. Sometimes labels can come out of the screen because it does not know where the cell restrictions are based on the size of the device. Thus, your shortcut can work off-screen if the shortcut is based on a landscape layout, but the device is iPhone 5 and, for example, in portrait. This is the Pin menu:

enter image description here

Hope this makes sense and gives even more color to this problem. Let me know if you have any questions, thanks for helping everyone!

+7
ios uitableview xcode6 storyboard
source share
4 answers

The problem is that you are using automatic layout, but you did nothing to determine the appearance of the table. The table view here is not your view of the controller; this is a sub. The view of the controller of your view automatically depends on the size of the device / window, but its views do not change automatically. This way you get a tabular view that is too wide for the device; the whole table is glued into space on the right side.

+10
source share

Use the trailing space to the right of the shortcuts to the edge of your supervisor and set it greater than instead of equals with a value of ~ 5

+3
source share

View the limitations of the tableview view using the view. Draw a cell border, label border, and tableview border with different colors to see which items are not displayed correctly.

Example:

 #import <QuartzCore/QuartzCore.h> ... cell.layer.border.width = 1; cell.layer.border.color = [UIColor blackColor].CGColor; 
+2
source share

The thing that worked for me to allow views to be viewed was to uncheck the Margin Limit checkbox in Auto Layout.

enter image description here

0
source share

All Articles