Tagged Questions
A constraint defines a relationship between two attributes of user interface objects that must be satisfied by the constraint-based layout system. Available in iOS 6.0 and later.
0
votes
0answers
23 views
Wrong constraints under iOS 6
I am trying to reproduce the parallax effect we can see everywhere nowadays, where, whenever you pull down a scrollview, an image reveals behind it (see this question).
There's a bunch of solutions ...
2
votes
2answers
43 views
Adding ChildViewController's view to a root ViewController
I want to add a child viewcontroller to a root view controller
in the interface builder i put a container which looks like this :
i wanted to add default margins of 20 to the container in relation ...
0
votes
0answers
19 views
Add layout constraints in UINavigationBar programmatically
I have a UIViewController displaying a view with a UINavigationBar. This UINavigationBar is created automatically as it is in a UINavigationController.
I would like to display a second ...
0
votes
0answers
64 views
Xcode 5.1 claims “adds new Auto Layout constraint inspector” - what's really different?
I'm still trying to get the hang of constraints, and was interested to see the top bullet point in new features for Xcode 5.1 (March 13, 2014) was a "new Auto Layout constraint inspector".
But I ...
0
votes
2answers
87 views
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) ...
1
vote
1answer
20 views
NSLayoutConstraints to UITextField - Error
I have a simple setup with 3 views:
view, which has 1 subview contentView, which has 1 subview emailField (a UITextField).
emailfField is not aligning in centerY correctly. I got is this error:
...
0
votes
2answers
91 views
+50
Setting runtime attributes on NSLayoutConstraint
I'd like to set the identifier property on a few of my constraints from within interface builder. I've used the User Defined Runtime Attributes table in IB before with NSView instances, and have had ...
1
vote
0answers
14 views
weird gap when using uiscrollview and uilabel
here is the problem i have a tow muti-line label with many content, so I use a scroll view to show them all
then I follow this to do the autolayout: ...
0
votes
1answer
33 views
+50
Strange behavior of UIScrollView with Constraints and RTL
I have an horizontal scroll view on which i add views dynamically.
On LTR languages everything work fine, i add views one after the other from left to right.
On RTL the problem is that the views ...
0
votes
0answers
15 views
Full screen MPMoviePlayerView overlay positioned using NSLayoutConstraint obscured
I am trying to add an overlay view called htmlButtonView to an MPMoviePlayerView while it is fullscreen as follows:
UIWindow *window = [UIApplication sharedApplication].keyWindow;
[[[window subviews] ...
0
votes
1answer
30 views
Autolayout animate x/y position of UIView without changing width/height
I'm trying to get used to animation with Autolayout and constraints instead of animation with frames. In my project I have a UIView near the top of the screen that I'm trying to animate straight ...
0
votes
1answer
24 views
How ensure a clean stacking of several dynamic UIView with Autolayout
Several times, I need to stack views which height that expect to change.
I code this https://github.com/damienromito/UIView-AutoYPositioning
But I think a best solution with NSLayoutConstraint.
...
0
votes
3answers
56 views
Unable to make outlet connection to a constraint in IB
I am running XCode 5 with iOS 7. I need to dynamically change the height constraint of a UITextView prior to its layout. I have seen many postings stating that this can be done by making an outlet ...
0
votes
2answers
31 views
NSLayoutConstraint gives so many warnings if i simply add scrollview in it
I have stuck at problem, in my application i am adding UIScrollview programatically so i am adding NSLayoutConstraint for that but when i run this output is perfect what i want but it gives me so many ...
0
votes
1answer
31 views
What are default constants for NSLayoutConstraint?
In Xcode I can put some controls on the window's contentView and they get default spacing according to some unknown rules. This depends on control types that are constrained. For example, two ...
1
vote
2answers
46 views
How to set autolayout constraint for UITextView
I have tried a lot to set auotolayout constraint for UITextView. But when i run , i get blank screen . I tried the same way in UIButton , that worked !!!!!
Is there any property to be set to assign ...
0
votes
3answers
149 views
How to set subviews with AutoLayout in UIScrollView programatically?
I am creating app with UiScrollview and UIPagectontrol using Autolayout Progrmatically, for
I have Created TKScroller as subclass of UIView, I am init it using Some Mode and Array.
TKScroller.m
...
0
votes
1answer
55 views
Error in Programatically Auto-layout vertically ios
I am creating view programatically, In it there is two sub views, I have set hieght and width constraint for that,
what i want is like this,
UIView (variable height)
[10px gap]
UIView (fix height ...
0
votes
1answer
52 views
Animate UILabel with Autolayout turned on not working
Below code is moving label's x position by 200pts its not animating
[UIView animateWithDuration:500.0f animations:^{
self.myLabelContraint.constant=200 ;
[self.view layoutIfNeeded];
...
0
votes
1answer
43 views
Different Views in a NSBox
In a view there is a NSBox. I have to create different controls (Labels, TextFields, PopupButtons, Radio Buttons) based on data, and I want to place these controls in that box.
Suppose the data is ...
0
votes
2answers
36 views
Auto Layout stick to bottom
I'm trying Auto layout for the first time and I'm stuck.
I would like an UIPageControl get stick to the bottom of my screen for 3.5 inch and 4 inch screen.
I tried to apply a Bottom Space to ...
-1
votes
0answers
18 views
uitableview edit like animation on uiscrollview with auto-layout constraints
I have a scrollview with custom uiview cells. The cells are laid out using auto-layout constraints. It contains uilabels among other views.
When entering edit mode I add a uibutton as a subview and ...
0
votes
1answer
29 views
gap between keyboard and textview during animation
I want to adjust the height of a textview when the keyboard appears. In iOS 7 this can be done by adjusting the NSLayoutConstraint between the textview and the bottomLayoutGuide of the view ...
0
votes
1answer
39 views
NSLayoutConstraint issue on tableView
I was trying to make a custom UITableViewCell, and when I add this uiview to my cell it seems theres a problem on my constraints. Can you help me trace the layout or constraints error..
0
votes
0answers
55 views
UIView+Autolayout is not giving me the proper positioning - what am I doing wrong?
I'm using the UIView+Autolayout library to make code-based Auto Layout constraint creation easier, but I'm having trouble adding a constraint with this library.
What I'm trying to do is this:
...
1
vote
1answer
49 views
Add UISLider with Autolayout programmatically
I'm trying to add a UISlider to my view programmatically including constraints so that its width adapts to the whole screen width.
This is what I got so far:
//2 Add UISlider
self.slider = ...
2
votes
1answer
61 views
Auto Layout without explicit width constraints and with greater-or-equal trailing space misbehaving
I've got a scroll view contained directly inside the content view of a view controller, at full size in both dimensions. The top, bottom, leading and trailing space constraints from the scroll view to ...
5
votes
2answers
82 views
Programmatically creating “spacing to nearest neighbor” constraint
Part of the screen I'm building includes a section with n views. I'm generating these views on the fly in code--they're simple UIView subclasses.
I'm using AutoLayout constraints for this screen, and ...
0
votes
1answer
40 views
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 ...
0
votes
2answers
58 views
Setting constraints in empty ViewController xcode 5
I have an empty ViewController. Programatically I'm setting back ground image.
- (void)setBackGroundImg:(NSString*) name {
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage ...
1
vote
0answers
29 views
Animating NSAutolayoutConstraint with UIViewAnimationOptionBeginFromCurrentState option
From this stack example i figured out how to animate the constant parameter of a named constraint. It works fine, but I've encountered a problem I haven't found a solution to. I have the ...
2
votes
3answers
66 views
iOS Auto Layout for Columns of Variable Width Labels
The Goal
I am trying to achieve the following design with auto-layout constraints:
What I've Tried
The middle label is straightforward (Horizontally Center to view).
The left and right labels ...
1
vote
2answers
176 views
Auto Layout iOS 7 - Can't align right of subview to right of UIScrollView
I am programmatically building a view and using autolayout, no interface builder at all. In a custom ScrollView controller, I am adding a UILabel and a UIButton as subviews. I want to align the label ...
1
vote
0answers
43 views
Best way to center two buttons with NSLayoutConstraint [closed]
I'm pretty new to NSLayoutConstraint and i'm trying to implement a very simple thing, just center two buttons. They must be placed in the center of the screen, one over another by 100 px. The first ...
0
votes
1answer
40 views
How do you use NSScrollView with auto layout?
Ok. I've been at this over and over. I've seen blogs and cocoa dev threads.
I've seen Kyle Sluder's proposed solution, but have yet to find a solution that really works.
How can you position ...
1
vote
2answers
33 views
NSLayoutConstraint animation duration in iOS7
I cannot figure out how to set NSLayoutConstraint animation duration in iOS7. Here's my code:
self.loadingViewTop.constant = -[[UIScreen mainScreen] bounds].size.height;
...
0
votes
0answers
39 views
Save NSLayoutConstraints to plist file
I have implemented auto layout pretty well in each and every project I have done till now. So I have a very good understanding but I got trapped when I wanted to save auto layout objects to a plist ...
0
votes
1answer
53 views
NSLayoutConstraint errors with resizing UITableViewCell
I have a custom UITableViewCell with a subview that resizes using Auto Layout. This subview is a toolbar at the bottom of the cell. It has a height of zero when the cell is unselected and grows to 30 ...
0
votes
1answer
34 views
Adjusting UITableView height when ad is received/not received
I am using Admob as an Ad provider. I have a UIViewController that has a UITableView which is set in the Storyboard to use the whole width and height of the controller.
When an Ad is received the ...
0
votes
0answers
15 views
positioning a UIButton when the red recording bar is fading away using NSLayoutConstraint
I have a view where I position a UIButton in the bottom right corner of the screen, by using a couple of NSLayoutConstraint definitions. When this view appears on screen WITH the red audio recording ...
2
votes
2answers
46 views
Autolayout crashes because of extra height constraint
I add a height layout constraint in code to my UICollectionViewCell subclass that sets the height based on the length of the text. See this question. I can post the code for the height calculations ...
2
votes
0answers
41 views
How to bind a vertical constraint programatically to a view?
I am reading into implementing iAd into my application.
Apple has provided a basic banner sample code.
I have a problem porting the solution to my UITableViewController. Since I don't use any xib ...
1
vote
1answer
49 views
Expand and Collapse Standard Cocoa Controls on a View
I want to do something similar to the calendar.app info panels, take a look at the pictures.
Here you can a see a very simple and compact info panel, but if you click on the last row "Add Notes, ...
-4
votes
2answers
89 views
Where should AutoLayout code be placed?
When I'm doing the initial setup of a UIView's subviews, if I initialise a UIView:
//Listing A
UIView *redBox = [[UIView alloc] init];
[redBox setBackgroundColor:[UIColor redColor]];
[self.view ...
0
votes
1answer
33 views
Trouble with Auto-Layout
Xcode 5
I'm trying to learn the auto-layout system. Thought I would start with something simple, but I'm already getting stumped :-)
Scene: Main View -> ImageView -> View
I want to support rotation ...
0
votes
1answer
42 views
Autolayout - adding and running constraint
I have a view with 2 container views: one main one on top and one at the bottom.
When the app launches, the bottom one is hidden via a frame that goes beyond the screen height. The top one in the ...
12
votes
2answers
291 views
What is a 'UIView-Encapsulated-Layout-Width' constraint?
I keep getting 'Unable to simultaneously satisfy constraints' exceptions (Xcode 5, iOS 7, both device and simulator), where one of the constraints in the list is something like this:
...
0
votes
1answer
74 views
Make two AutoLayout constraints equal in code?
I’m pawing my way through AutoLayout for the first time (and not using IB/storyboards to do so), and I’m trying to do some simple vertical alignment in a UITableViewCell, of a title label and a detail ...
0
votes
2answers
117 views
SIGABRT Crash when creating constraintsWithVisualFormat
Trying my hand at the visual format language for iOS but I'm getting a sigabrt when trying to initialize the constraints. Any glaring issues with this code?
NSNumber *inset = [NSNumber ...
1
vote
1answer
132 views
Change a set NSLayoutConstraint programmatically later
I'm creating a View in code (no xib or storyboard for this one) and setting the constraints in code, like:
NSDictionary *bindings = NSDictionaryOfVariableBindings(_myView);
_myView = [[UIView alloc] ...