1

I stumbled on to a problem to which i am not sure how to fix.

enter image description here

As you can see here the Label where the name is supposed to be,(i get the name from a user input meaning its dynamic). If it is written to long, it just writes over the other labels.

Also in the storyboard the UILabels are not set to be longer than another label. Each label ends right before the other one starts.

FYI i have already used constraints to make them have the position that they should. Any suggestions?

EDIT1

Also the name label to the right(the last cell) there should be more text but it is not visible. As if it is continuing to write over the edge?

EDIT2

Here is an image showing the constraints i have on the label and some other useful info. enter image description here

EDIT3

Here is an image after i tried to remove the constraints and i even made the label so small but the results are still the same. The text is going all the way to the score label

enter image description here

Timo Cengiz
  • 3,367
  • 4
  • 23
  • 45
  • 1
    Which label are you talking about in the picture? – rmaddy Mar 21 '15 at 21:15
  • the one with "sjsjsjsjsjsh" that is writing over the orange label that is supposed to show the score – Timo Cengiz Mar 21 '15 at 21:16
  • What behavior should happen in this case? – mginn Mar 21 '15 at 21:17
  • I guess it should show as much as it can and then the last 2 or 3 few spaces it should be standard that it shows dots? like this for example: Ronald... – Timo Cengiz Mar 21 '15 at 21:18
  • This is happening because the labels overlap. If the label on the left were fixed length and stopped where the right label started, the text in it would be truncated somehow. (But if you picked an option that says "extend this label if necessary", that could be your problem.) – Hot Licks Mar 21 '15 at 21:18

1 Answers1

2

Your constraint of the label width is set to 221, so its width will be 221 no matter what screen it is on. Thats why on simulator it behaves like this(different screen size than storyboard). Your constraints are wrong, thats why its overlapping, your label is bigger than its suppose to be.

EDIT

Set score label width constraint, set score label center horizontally and vertically in superview. Now right text label attach to this score label and superview, and left text label attach to this score label and time label, also set this time label width contraint so it doesnt change, its a small text and u know the size of it all the time, so you can keep it at width like 30. Now you are done, your text labels are adjusting their size according to screen.

If its still not working, check your superview has set constraint to adjust to screen size, as well as tableview.

Community
  • 1
  • 1
IxPaka
  • 1,990
  • 1
  • 16
  • 18
  • Thats true, Now i have the problem when i remove the with and height constraint to be constant the constraints are all messed up now :( – Timo Cengiz Mar 21 '15 at 21:53
  • Don't know if people still watching over here but it did not work. i removed the constraints and made the UILabel really small but it still wrote over the label – Timo Cengiz Mar 22 '15 at 09:08
  • Are you using a custom cell there? – Jassi Mar 22 '15 at 09:53
  • Should i not attach the left text label to the left imageview aswell as the right text label to the right imageview? – Timo Cengiz Mar 22 '15 at 14:52
  • Every time i try to set a constraint from the left label text to the score then the score label, the imageview, and the right text label all gets pushed to the right(to the edge) – Timo Cengiz Mar 22 '15 at 15:01