Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:41:32+00:00 2026-06-14T11:41:32+00:00

So, I can’t get my head around constraints in interface builder. I can’t add

  • 0

So, I can’t get my head around constraints in interface builder.

I can’t add them myself – interface builder seems to think that it knows best.

I also can’t take them away (I can convert to a “user” constraint, then delete, but interface builder will just replace it with the same constraint again).

I thought constraints were supposed to help you with changing layouts and all sorts – i.e. building views for iPhone 5 and earlier ones. Also, moving from portrait mode to landscape mode.

I can’t seem to get it to work at all. If I add a view and I place it below the top of the superview then it will set a Top space to: constraint. This will be a pixel value which means that when I view on the shorter iPhone 4 (or if the phone turns landscape) these elements don’t auto move up.

For instance, I am trying to create a custom keyboard view – one similar to that you would see on a cash register. I have created a custom UIView subclass and now I have put a UIView into interface builder. I have set the height and width and positioned it at the bottom of the view (where it “clicked” into place). How interface builder has added a Top space to constraint putting it at that height (iphone 5). So if I view it on the iPhone 4 it doesn’t budge up (as I would expect, as I “snapped” it into place at the bottom of the screen) but instead cuts off the bottom.

This isn’t what I wanted, but (as above) I can’t delete the constraint unfortunately.

What can I do? I am aware that I could just create two nib files (for iPhone 5 and for other iphones) but what about when I want things to auto-budge when I turn the phone landscape?

Thanks for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:41:36+00:00Added an answer on June 14, 2026 at 11:41 am

    You can’t remove a constraint in Interface Builder if doing so would leave insufficient constraints to determine completely the size and position of any interface widget.

    • One solution: add more constraints, until the size and position are overdetermined. You will then be able to delete one of the superfluous constraints. For instance, you gave this example:

      I have set the height and width and positioned it at the bottom of the
      view (where it “clicked” into place). How interface builder has added
      a Top space to constraint putting it at that height (iphone 5). So if
      I view it on the iPhone 4 it doesn’t budge up (as I would expect, as I
      “snapped” it into place at the bottom of the screen) but instead cuts
      off the bottom.

      Select the view and choose Editor > Pin > Bottom Space to Superview. Now you have more constraints than you need: the height, the width, something determining the horizontal position (which you forgot to mention), and a pin to the top of the superview and a pin to the bottom of the superview. Thus you can now delete the pin to the top.

    • Another solution: remove the unwanted constraints in code. A constraint is an ordinary interface object, so you can make an outlet to it and remove it when your code runs. However, if you do this in such a way as to leave the size or position underdetermined, you will get unpredictable results (“ambiguous layout”), so be careful.

    • Still another solution: reduce the priority of unwanted constraints in IB. Interface Builder will ensure that all values are absolutely determined. But perhaps you know, for example, that the superview will change size and so some of the constraints created by Interface Builder will be undesirable. You can’t delete them, but you can reduce their priority. Thus, in your example, you might end up with a pin to the top and a pin to the bottom, but you could then just reduce the priority of the pin to the top.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can any one tell, how to get the result of LINQ query contains group
Can we change the color of the divider? Apple documentations says, that we can
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Can anyone tell me how an IDE like NetBeans or any for that matter
Can i get the source code for a WAMP stack installer somewhere? Any help
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
Can find why i get this error can someone help? package Android.data; public class
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.