Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands
Hi all,

I know I'm sounding noobish now.. But.. How does these constraints work ?

Lets say I have an 'header' view.
I want this header view stay the same height as it is. So I add the constraint to "Pin" the height.
Now I want to to be as width as the self.view.. So I rightlcick my 'header' to 'view' and say equal width.
Doing the same for leading space, and top space.

So now I have set constraints for top, left, width and height.

Left and Top of 'header' is 0.

I have a preview of 4.5" 5" and iPad, on the iPad I see that there is space between the left and my header, 20 ? or little less, but more than default -16

Can anyone help me out, if someone understands what I'm talking about ?
 

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands
Hi all,

is there someone that can explain this to me ?

On iPhone's I need to use Leading space -16
On an iPad I need to use Leading space 0

How can I fix this ?
This is pretty urgent and starts to annoy me big time now.

I'm taking leadingspace from the self.view
 

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands

I did, but nowhere is mentioned difference between autolayout constraints for iPad and iPhone.

On iPhone it's fine, on iPad I need to change Leading horizontal space to -20, but then I'm getting an gap at the right side on the iPhone.

Shouldn't Leading horizontal space be 0, equal width of the 'view' / self.view ?
Then I even get a bigger gap at the left.

Anyone please advice what to do about this.
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,877
243
Novi, MI
I did, but nowhere is mentioned difference between autolayout constraints for iPad and iPhone.

On iPhone it's fine, on iPad I need to change Leading horizontal space to -20, but then I'm getting an gap at the right side on the iPhone.

Shouldn't Leading horizontal space be 0, equal width of the 'view' / self.view ?
Then I even get a bigger gap at the left.

Anyone please advice what to do about this.

Are you sure you aren't confusing "leading space to container" and "leading space to container margin"?

In iOS 8 Apple added a container margin. You can override this by holding the option key after you ctrl+drag out your constraints. If you set your constraint to the container margin = 0, then it's going to be 16 points from the edge of the actual container. However, if you hold option and select to set the constraint relative to the container = 0, it will be at the edge of the container.
 

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands
Are you sure you aren't confusing "leading space to container" and "leading space to container margin"?

In iOS 8 Apple added a container margin. You can override this by holding the option key after you ctrl+drag out your constraints. If you set your constraint to the container margin = 0, then it's going to be 16 points from the edge of the actual container. However, if you hold option and select to set the constraint relative to the container = 0, it will be at the edge of the container.

\o/
bless you!!!!!!!
Kudoosssssss
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.