ios - uiscrollview programmatically in autolayout -
i new auto layout concept. adding scroll view programmatically, works in ios 8 in ios 7 scroll view not working, can 1 me how can work?
uiscrollview *scroll = [[uiscrollview alloc]init]; [scroll settranslatesautoresizingmaskintoconstraints:no]; scroll.contentsize=cgsizemake(480, 700+100); [contactview addsubview:scroll]; nsdictionary *scrolldic = @{@"scrollview":scroll}; nsarray *scroll_h = [nslayoutconstraint constraintswithvisualformat:@"h:[scrollview(480)]" options:0 metrics:nil views:scrolldic]; nsarray *scroll_v = [nslayoutconstraint constraintswithvisualformat:@"v:[scrollview(568)]" options:0 metrics:nil views:scrolldic]; [scroll addconstraints:scroll_h]; [scroll addconstraints:scroll_v]; nsarray *scroll_posh = [nslayoutconstraint constraintswithvisualformat:@"h:|-0-[scrollview]" options:0 metrics:nil views:scrolldic]; nsarray *scroll_posv = [nslayoutconstraint constraintswithvisualformat:@"v:|-140-[scrollview]" options:0 metrics:nil views:scrolldic]; [self.view addconstraints:scroll_posh]; [self.view addconstraints:scroll_posv];
is correct way set scroll view?
Comments
Post a Comment