objective c - Resize a view when another is hidden -
i have 2 views on iphone screen, 1 above other (mediacontrols above devicewebview). when hide top view want bottom view take entire screen, , when reveal top view want bottom view resize again below top view. seems simple having trouble it. i've tried hiding view adjusting layout constraints show below.
heres code:
-(void)hidevideobuttons{ self.mediacontrols.hidden = yes; [self.view removeconstraint:self.devicelayoutconstraint]; [self.devicewebview setneedsdisplay]; } -(void)showvideobuttons{ self.mediacontrols.hidden=no; self.devicelayoutconstraint = [nslayoutconstraint constraintwithitem:self.devicewebview attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:self.mediacontrols attribute:nslayoutattributebottom multiplier:1 constant:0]; [self.view addconstraint:self.devicelayoutconstraint];
have tried uiview animatewithduration: animations: method? can animate uiview(s) whatever location you'd like, can resize them, , more.
[uiview animatewithduration:1.0 animations:^{ // moving device web view self.devicewebview.transform = cgaffinetransformmaketranslation(xvar, yvar); // moving other view otherview.transform = cgaffinetransformmaketranslation(xvar, yvar); }];
the xvar , yvar not variables being set. showing usage of method. you'd replace them x , y locations of screen wanting move x , y of view to. i'm not sure if you're looking for, seems looking way animate views, here's suggestion :)
hope helps!
Comments
Post a Comment