3

enter image description here

The warning message i get is that 2 views are vertically ambiguous( looks fine when i run it btw)

The two views that its talking about is the two score labels. My first question is what does the warning mean and how would i be able to solve it.

Second question is. DO i need to put constraints on the other labels inside that same cell since they look fine with all the screen sizes since they start att the start from the left? Cause it was just the two score labels that were not showing in the smaller screens but the other labels were perfect.

Thank you.

  • You should add constraints for all the labels and other controls within your cell. I would recommend doing that first before attempting to resolve the vertical ambiguity. You may find that the ambiguity goes away when everything is constrained. – Mike Taverne Mar 07 '15 at 18:26
  • But why do i need to add constraints when they already look fine with all the different screens? @MikeTaverne –  Mar 07 '15 at 18:31
  • You can get unpredictable results when you don't constrain things. And once you start specifying constraints for some controls, you will start getting warnings or errors for controls that are not specified. – Mike Taverne Mar 07 '15 at 19:00
  • 1
    btw: you have the "top space" constraint applied two times. – luk2302 Mar 07 '15 at 19:24
  • Man i hate constraints, i just dont get how to fix the way i want to. Its the last thing i need to fix b4 my app is rdy to launch gahw.. –  Mar 07 '15 at 19:37
  • For your prototype cell labels, you should only need (1) a leading or trailing space constraint, and (2) a top or bottom space constraint. Since labels have intrinsic size, they are easier than most other controls to position. – Mike Taverne Mar 07 '15 at 20:58
  • Your bottom "score" label y constraint is connected to top "score" label, whether your top "score" label has proper y position defined? What are the constraint for your top "score" label? – Nuzhat Zari Jan 30 '17 at 04:13

1 Answers1

1

I had the same problem yesterday, I know, we all hate having to waste ridiculous amounts of time with a terrible tool such as Xcode´s layout. The technique that worked for me is to create constraints from the top views to the bottom, usually 3 per view (Leading, Trailing and Top), plus the key part here: once the ambiguous error is the only warning left, let Xcode "add missing Constraints", which will usually be a horizontal center reference for one of the views. I used this article for reference: http://mobileoop.com/auto-layout-advanced-techniques-for-ios-8-and-7-using-xcode-6-on-storyboard

Josh
  • 6,251
  • 2
  • 46
  • 73
  • that was the thing that resolved it for me too, awfully silly but xcode seems to be full of silly things like this. – Eman Aug 09 '21 at 21:09