ios - Creating a vertical spacing autolayout constraint -


i've got autolayout constraint attaches view above tab bar. specifics of aren't important, works fine.

nsdictionary *views = @{@"view":self.collectionselectioncontainer, @"bottomlayoutguide":self.bottomlayoutguide}; nsdictionary *metrics = @{@"offset":@(tabbarheight)}; [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:[view]-offset-[bottomlayoutguide]" options:0 metrics:metrics views:views]]; 

however, want create constraint using other method:

[nslayoutconstraint constraintwithitem:attribute:relatedby:toitem:attribute:multiplier:constant:] 

i've tried various ways unsuccessfully. can show me how?

thanks

i figured inspect nslayoutconstraint returned array constraintswithvisualformat! great way figure out , build method there:

the answer this:

self.collectionselectionbottomconstraint = [nslayoutconstraint constraintwithitem:self.bottomlayoutguide attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:self.collectionselectioncontainer attribute:nslayoutattributebottom multiplier:1 constant:tabbarheight]; [self.view addconstraint:self.collectionselectionbottomconstraint]; 

i think reason being unsuccessful before was passing 0 multiplier.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -