Tag: nslayoutconstraint

Hide autolayout UIView : How to get existing NSLayoutConstraint to update this one

I know how to modify a existing constraint. But I would to know if someone has found a solution to get a constraint without save this one as a property. Current solution to set Constraint height: 1) save NSLayoutConstraint in a variable: NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:myView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:20]; [self.view addConstraint:heightConstraint]; […]

UITextView inside UIScrollView with AutoLayout

I am trying to place UITextView inside UIScrollView with AutoLayout with no luck. What I have tried is, I placed UIScrollView inside the main view in Storyboard I placed UITextView inside UIScrollView in Storyboard and disabled Scrolling Enabled I set constraints (leading, trailing, top, bottom) on UIScrollView I set constraints (top, leading, trailing, height) on […]

Setting constraints to UIScrollView

Need some help to set constraints to UIScrollView. I tried to follow the instructions here: https://developer.apple.com/library/ios/technotes/tn2154/_index.html (Mixed approach). Setting 4 sided constraints to UIScrollView. Then set 4 sided constraints to the buttonContainer. This the result: However xcode is giving this error message: If I try xcode’s recommendation, either the scrollview will not scroll, or it […]

Align text fields using dynamic constraints

I’ve been learning how to make iOS apps, and have come across a minor annoyance. I can’t find an easy way to align my text inputs. Looking at the below screenshot, you will see that I’ve managed to align my text fields, which is what I want. However, I did this manually by changing the […]

Understanding Constraints using Xcode and Manually Coding

I just read few information about how to manipulates constraints number programatically, but I think I need to see it visually using Xcode. So I decided to put a UIView like this and see what’s going on with Constraints : automatically it will create 4 constraints : after modifying the number, I got what’s the […]

NSLayoutConstraint SIGABRT on iPad

Application is made in Interface builder. Seperate storyboards for iPhone and iPad. Project runs and works properly on iPhone Simulator, iPad Simulator, iPhone 4 with newest iOs, but I get this error when I build it on ‘new iPad’ spring 2012 with iOs 5.1. Fix/explanation? 2012-12-12 16:44:16.763 LNG[397:707] *** Terminating app due to uncaught exception […]

iOS Constraints on Grid of Equal Width/Height Buttons cause positioning and size to vary

I’m updating my Calculator app to use new dynamically sized buttons and having a problem with the constraints. The contains should work fine as far as I can tell, but Xcode complains about misplaced views. The values it gives for the misplaced views are not proper and if I try to fix them, then it […]

Xcode auto layout constraints – why defaulting to negative padding?

I am simply adding a UIView into the main view of a view controller. I want the height to always be 64px, but the width to stretch to the width of the screen. However, when I go to add constraints, the left and right padding default to -16, even though the view is stretched all […]

UITableViewAutomaticDimension not working in Xcode 6.3

I updated my Xcode to 6.3 along with Swift 1.2, and I made the transition. Everything works except dynamic row height for table view. I have those on 3 completely different table views, so it probably isn’t something else influencing the bug. I set all of the table views to: tableView.rowHeight = UITableViewAutomaticDimension and all […]

Swift Constraints in Subclass

I was wondering if there was a way to access constraints from a subclass. I have a custom view. I’m not sure if I can access the constraint I already have set in the UI, so I tried just creating the constraint from the subclass itself. class PerformanceView: UIView { func initialize() { let heightConstraint […]