Tagged Questions
1
vote
1answer
17 views
Is it possible to access/manipulate the constraints in a nib file from the view it's loaded into?
Example project: http://cl.ly/1g1L3E2Z0r1c
I create a nib file and then create some views in it, which I then load into another view controller. In the view that I bring in, it's a subclass of UIView ...
4
votes
0answers
39 views
Why am I getting a “Auto Layout still required after executing -layoutSubviews” error every time my app launches now?
Since I added the following code, every time my app opens this UITableViewController it crashes:
self.noArticlesView = [[UIView alloc] init];
...
1
vote
1answer
26 views
Programmatic Vertical Alignment of UIPageControl in Superview using NSLayoutConstraint
Up until now, I was able to avoid using Auto Layout, so apologies for the (potentially) stupid question.
I have a ViewController that is being built programmatically (e.g., no IB).
I have a ...
1
vote
2answers
41 views
How to use AutoLayout to position UIButtons in horizontal lines?
I need to create a couple of UIButtons with various widths programmatically in my app (iOS 6.0 and above).
I want to display the buttons in a "wrap around" style: Starting from the left edge, each ...
1
vote
2answers
39 views
UILabel Autolayout width trouble
So I'm trying to use autolayout for cell content view to get the proper layout. So my problem is that I have a UILabel that changes its size with respect to its text and I also have a UIView as a ...
0
votes
2answers
38 views
How do I position a UIView at the centre of two other UIViews with Auto Layout?
I have a UIView in the middle of two other UIViews. Say they're called "Top", "Middle", and "Bottom". "Top" and "Bottom" are both position 20pt from the top and bottom respectively. How do I position ...
-1
votes
0answers
14 views
Adding subview breaks interface
I've designed a view with the Interface Builder.
It contains UIImageView ,UIToolBar, etc... And and I've set all constraints with the IB in the .xib file.
Now, in this view, there is some animations ...
0
votes
3answers
39 views
Animation with constraints completes instantly
I have some animation I'm trying to convert over to constraints. The idea behind it is that a login prompt bounces when there's an error.
My approach is that everything on the view controller is ...
4
votes
0answers
71 views
how can I use one storyboard for 4“ and 3.5” iphone screens with autolayout (ios6 + ios7)?
While there are many questions and answers about building a storyboard layout that would work both on 4" and 3.5" screen sizes, I couldn't find a suitable solution for the following scenario.
I use ...
0
votes
1answer
28 views
Can i change multiplier property for NSLayoutConstraint?
I create two views in one superview
for example: view1 and view2
then i added constraints between views
_indicatorConstrainWidth = [NSLayoutConstraint constraintWithItem:self.view1 ...
1
vote
1answer
36 views
Add a number of buttons to view with X,Y,padding constraints using autolayout programatically
Let say I have a N numbers of buttons..
//---listOfServicesToDisplay is DYNAMIC
NSMutableArray * arrayOfButtons = [NSMutableArray array];
for (int i=0; i<[listOfServicesToDisplay count]; i++) {
...
0
votes
1answer
18 views
iOS auto-layout constraints: ignore hidden or zero-size view?
I need to horizontally layout two labels and an image:
[label1]-10-[icon]-10-[label2]
the problem is when label1 does not have a text (ie empty text), then there is still 10 pts spacing between ...
0
votes
2answers
42 views
Why is my UIButton not getting added to my cell?
In my cellForRowAtIndexPath: method I have the following code:
UIButton *signOutButton = [[UIButton alloc] init];
[signOutButton addTarget:self action:@selector(logoutButtonTapped) ...
0
votes
0answers
50 views
UIView animation issues with autolayout and constraints
I'm developing an app which has a feature allowing the user to select an image from their photo library and attach a caption to it, for display in a UICollectionView. I'm using storyboards and ...
1
vote
2answers
70 views
Using Auto Layout, how do I make two labels on the same “line” be dynamic in their widths (adjusting with how wide each one needs to be)?
Say I have two UILabels, one is a URL and one is a timer:
[http://website.com/link/to/specific/story] [9m 42s]
But the "timer" UILabel changes width a lot. Sometimes it is just 12s for example, ...
0
votes
1answer
21 views
not able to display controls add in scroll view's content view using auto layout
I am new in auto layout part. I am creating one view with scroll programatically but I am not able to add controls in the content view of scroll view
Here is my code:
-(void)setConstraints
{
...
1
vote
2answers
40 views
Why is this constraint not working?
In my table view's cellForRowAtIndexPath: method I have the following code to add an image and align it in the cell:
UIImageView *PocketIcon = [[UIImageView alloc] initWithImage:[UIImage ...
0
votes
0answers
14 views
reseting an view's constraint
So I added a constraint to a imageView
[NSLayoutConstraint constraintWithItem:imageView
attribute:NSLayoutAttributeLeft
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
...
0
votes
0answers
34 views
manual constraints of auto layout conflict with constraint defined on XIB
I am learning about auto layout and giving the layout using constraint manually on lable and button.
Now if I create that two controls dynamically and add as a subview to my main view and give ...
0
votes
1answer
56 views
table view disappears when I add a constraint
I have a container view:
and I have a table view that I add to the container programmatically:
self.searchResultsSourcesTVC = [storyboard ...
0
votes
0answers
7 views
-[NSLayoutConstraint shouldBeArchived]?
How do I know what to set -[NSLayoutConstraint shouldBeArchived] to?
When would a UIView be archived?
0
votes
0answers
25 views
IOS 6 project using NSLayoutConstraint color of view does not setted
there is such a question. I am in my IOS 6 project using NSLayoutConstraint to bind the lower to the upper view programmatically. Lower and upper views i sets the property
[titleView ...
0
votes
1answer
44 views
Is it possible in Interface Builder and Auto Layout to say “make this UILabel centered with the center of that other UILabel”?
Is that only possible in code? Or can I do it in Interface Builder. If it's only possible in code, how would I do that?
1
vote
1answer
68 views
How do I animate the move a UILabel with auto layout constraints?
I'm trying to move a UILabel to the left and animate the movement. The UILabel is created from a storyboard, and has the following constraints:
But if I try to make the trailing space constant ...
2
votes
2answers
216 views
Creating Auto Layout constraints to topLayoutGuide and bottomLayoutGuide in code
Apple's documentation on creating Auto Layout constraints between a view and one of the layout guides only shows an example using VFL.
Is there any way to create these constraints programmatically ...
1
vote
3answers
47 views
With iOS layout contraints is it possible to collapse padding between labels when height is 0?
Consider a view that contains three UILabels with vertical contraints defined as follows:
[self.view
addConstraints:[NSLayoutConstraint
...
0
votes
1answer
78 views
Using Constraints To Keep Two TableViews The Same Height & The Same Distance Apart
Context / What I'd Like to Do
I'm building this for iOS 7
I'm using a StoryBoard
I have two UITableViews, that I'd like to keep the same height and
distance apart, to retain visual consistency ...
0
votes
0answers
47 views
Subview position when resizing aspect fill UIImageView
I'm trying to create layout of multiple UIImageViews that would retain correct visual alignment after scaling. Eg.:
UIImageView *eyeView = [[UIImageView alloc] initWithImage:eyeImage];
...
2
votes
1answer
120 views
Auto Layout: why do conflicting required hugging priorities & fixed-width constraints not throw an exception?
I have the following setup:
A custom subclass of UIView that defines a fixed intrinsicContentSize of (50,50)
An instance of this view as the only subview of a new app's window
Horizontal and ...
0
votes
2answers
60 views
How do I define a layout constraint to keep one label the width of its content and allow another label to fill the remaining space?
Consider the following desired layout. Note that this is not a "layout string" but a proxy for a picture. So | = superview edges, - = space, [xxx] = a view.
...
0
votes
0answers
28 views
NSLayoutConstraint issue
i am having this nslayoutconstraint issue in my app can anybody help me with this ,
my app is universal on autolayout and change views on landscape and portrait
Probably at least one of the ...
0
votes
0answers
21 views
Custom popup with flexible size
I was using SBTableAlert to display alert to users asking for a single or multiple choice. But Now with IOS 7, this doesn't work anymore.
So I was designing myself a new view as a pop-up to replace ...
0
votes
1answer
100 views
how to horizontally align 3 subviews of a UIView with NSLayoutConstraint visual format
I have the following setup:
A UIView with size (40,40)
3 subviews of this view, each with frames (0,0,40,40)
Now I'd like for this setup to have the following constraint hold at all times:
...
0
votes
1answer
74 views
How do I represent the content of this UITableCell programmatically using Auto Layout?
I have just started using Auto Layout for my latest project and I was wondering what would be the most efficient way of laying out the following table cell:
Views A and B are both UILabels. C is a ...
1
vote
3answers
462 views
Width and Height Equal to its superView using autolayout programmatically?
I've been looking for a lot of snippets in the net and I still can't find the answer to my problem. My question is I have a scrollView(SV) and I want to add a button inside scrollView(SV) ...
0
votes
0answers
63 views
Autolayout: Can't lay out two views, one left aligned and the other right aligned
I'm facing strange behaviour with autolayout. I want to add a container view to the viewcontroller and then add two labels: one is has its left aligned to the left of the container, while the other ...
0
votes
3answers
47 views
clarifications regarding autolayout in iOS
I have searched the iOS developer library and cant find the answer.
what does vertical/horizontal spacing mean?
What exactly is the "default" (when you check the box "standard" in constraint attribute ...
5
votes
3answers
150 views
What happens with constraints when a view is removed
The question I have is simple but I couldn't find any information in the documentation.
What happens with layout constraints when a view is removed from the view hierarchy (or moved to another view)?
...
0
votes
2answers
51 views
Get same result with NSLayoutConstraint as with Autosizing
In my UI I have 5 buttons at the bottom. With autosizing applied to every button like on the picutre:
I get desired results:
However, when I tried to do it with Autolayout in IB or in code like ...
0
votes
0answers
50 views
constraint error when changing constants
I'm changing UIImageView's constraint constants when user taps the view and animate the constant change. The way I'm doing this is like this:
//Search for constraints associated with the ImageView
...
2
votes
1answer
83 views
Autolayout Constraints Priority
I have 2 UILabel labelA and labelB and a width of 320 px. I created constraints
H:|-[labelA]-(>=4)-[labelB]-|
Unfortunately, labelA and labelB can sometime be big and would not fit without ...
5
votes
1answer
150 views
Autolayout confusion: Constraints for ScrollView with WebView and Header/Footer Views
To illustrate my problem, I created the following graphic:
The black border around the red square is supposed to be the iPhone screen. Inside, we have in red a UIScrollView, which is taller than ...
1
vote
1answer
61 views
Unable to right-align view using contraints
I have a tableview that uses a custom UITableViewCell. The cell contains a UILabel that needs to be right-aligned in the cell.
This is an iPad app. I've designed the custom cell to fit in portrait ...
0
votes
0answers
37 views
Where to add a layout constraint with a mutable constant
I have a scroll view containing a single large view, contentView. The size of this view is informing the scroll view's content size via autolayout.
When I set up the contentView in viewDidLoad, I set ...
0
votes
0answers
39 views
Autolayout Error with UITableView
I have a UITableView and I specify the height for each cell using the delegate method cell height for row at index path.
when I rotate the view I get this error that I don't quite understand
it ...
1
vote
2answers
131 views
Rearranging Cell Subviews When UITableViewCell Resizes
I have a UITableViewCell that is implemented using storyboard that looks like:
Here is what the cell should look like without an image:
I have been fiddling with the constraints and banging my ...
0
votes
1answer
53 views
How do I shift two UIViews 270px to the right in AutoLayout in code?
I have a UIView that is offscreen 400 pixels to the left and is 280 pixels wide.
I'm trying to shift the main UIView to the right 280 pixels and to have the offscreen UIView move onscreen to the ...
0
votes
1answer
483 views
Centering subview's X in autolayout throws “not prepared for the constraint”
I have a custom UIView subclass which is being initialized via a nib.
In -awakeFromNib, I'm creating a subview and attempting to center it in its superview.
[self setInteralView: [[UIView alloc] ...
0
votes
1answer
52 views
Does it matter which superview I add constraints to?
Let say I have 3 views
A|----------|
| B|-----| |
| | C ▢ | |
| |_____| |
|__________|
If I have a constraint involving view B and view C.
The documentation suggests adding to ...
7
votes
1answer
155 views
How do I move a label and animate the change using Auto Layout?
I'm trying to move a UILabel to the left and animate the movement. The UILabel is created from a storyboard, and has the following constraints:
But if I try to make the trailing space constant ...