ios - iCarousel AutoLayout Multiplier issue -


i trying use multipliers on icarousel layout not seem have affect @ all. code:

_carousel = [[icarousel alloc]init ]; self.items = [nsmutablearray array]; (int = 0; < 10; i++) {     [_items addobject:@(i)]; } _carousel.type = icarouseltypecylinder;  _carousel.delegate = self; _carousel.datasource = self;  _carousel.translatesautoresizingmaskintoconstraints = false;  [self.view addsubview:_carousel];  [_carousel.centerxanchor constraintequaltoanchor:self.view.layoutmarginsguide.centerxanchor].active = true; [_carousel.bottomanchor constraintequaltoanchor:self.view.layoutmarginsguide.bottomanchor constant:-80].active = true;  [_carousel.widthanchor constraintequaltoanchor:self.view.widthanchor multiplier:40.0/100.0].active = true; [_carousel.heightanchor constraintequaltoanchor:self.view.heightanchor multiplier:30.0/100.0].active = true; 

i have noticed if input constant value of -20 in:

[_carousel.bottomanchor constraintequaltoanchor:self.view.layoutmarginsguide.bottomanchor constant:-20].active = true;  

the icarousel drops below views bottom anchor , don't know why?

can answer these please, forgive me if i've overlooked i'am new programmatic layouts.

you should override , move code loadview avoid having auto layout engine generate prototyping constraints. example:

- (void) loadview {    [super loadview];     _carousel = [[icarousel alloc]init ];     self.items = [nsmutablearray array];     (int = 0; < 10; i++)     {         [_items addobject:@(i)];     }     _carousel.type = icarouseltypecylinder;      _carousel.delegate = self;     _carousel.datasource = self;       _carousel.translatesautoresizingmaskintoconstraints = false;      [self.view addsubview:_carousel];      [_carousel.centerxanchor constraintequaltoanchor:self.view.layoutmarginsguide.centerxanchor].active = true;     [_carousel.bottomanchor constraintequaltoanchor:self.view.layoutmarginsguide.bottomanchor constant:-80].active = true;      [_carousel.widthanchor constraintequaltoanchor:self.view.widthanchor multiplier:40.0/100.0].active = true;     [_carousel.heightanchor constraintequaltoanchor:self.view.heightanchor multiplier:30.0/100.0].active = true;   } 

in general loadview want add subviews programmatically uiviewcontroller subclass.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -