ios - Autolayout constraint is not working after animation -
this question has answer here:
i little bit new @ autolayout.i know tons of question , tutorial available regarding autolayout have not found solution.so in advance help.
what requirement?
i have make uiview come screen after pressing button bottom side of screen animation.(like keyboard).i have made uiview in xib file using autolayout.so far have done this.
in viewdidload:
//loading custom uiview  containerview = [[sharingpickerview alloc] init]; [containerview loadingmenus:pickerdata]; [self.view addsubview:containerview]; in view contatains (a scrollview page controller cancel button)
in viewwilllayoutsubviews:
-(void)viewwilllayoutsubviews{ [super viewwilllayoutsubviews];  //changing frame of view bottom side of screen can animate later bottom top later.  containerview.frame = cgrectmake(0, self.view.frame.size.height, self.view.frame.size.width, containerview.frame.size.height); [containerview setbackgroundcolor:[[uicolor colorwithred:231.0/255.0f green:231.0/255.0f blue:231.0/255.0f alpha:1.0f] colorwithalphacomponent:0.3]]; } now on press animation.
-(void)sharepickerview{    [uiview animatewithduration:1 animations:^(){    containerview.frame = cgrectmake(0,self.view.frame.size.height-containerview.frame.size.height, self.view.frame.size.width, containerview.frame.size.width);    } completion:^(bool isfinished){   nslog(@"animation finish");    }]; } here re-framing view showing animation bottom portion(cancel button of view) not showing in iphone 6 simulator showing iphone 5s device.
regards emon.
try use size constraints outlets. can easy change values of constraints. it's not recommended modify frame when using auto-layout.
declare property:
@property (strong, nonatomic) iboutlet nslayoutconstraint *heightconstraint; and in implementation:
heightconstraint = self.view.frame.size.height; also post may helpful: autolayout, constraints , animation
Comments
Post a Comment