ios - UIViewController half screen "drawer slide" animation -


i trying have uiviewcontroller appears "slide" animation right. not push segue, not facebook app. want new viewcontroller slide on top of current 1 (not push away), cover part of screen, leaving other part showing first viewcontroller.

what have tried: closest have gotten creating custom segue following:

- (void)perform {     __block uiviewcontroller *src = (uiviewcontroller *) self.sourceviewcontroller;     __block uiviewcontroller *dst = (uiviewcontroller *) self.destinationviewcontroller;      catransition* transition = [catransition animation];     transition.duration = .50;     transition.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout];     transition.type = kcatransitionmovein;     transition.subtype = kcatransitionfromright;      [src.navigationcontroller.view.layer addanimation:transition forkey:@"switchtoview1"];     [src.navigationcontroller pushviewcontroller:dst animated:no]; } 

this achieves animation going for, covers entire first viewcontroller. how make stop @ point , not cover entire thing?

i using storyboards, , first time trying sort of new animation.

you can try doing in source view controller, , changing frame destnation (the x axis) like:

- (void) perform {         uiviewcontroller *dst = (uiviewcontroller *) self.destinationviewcontroller;      [dst.view setframe:cgrectmake(160, 0, your_dst_width, your_dst_height)];      //your animation stuff...      [self addchildviewcontroller:dst];      [self.view addsubview:dst.view];      [dst didmovetoparentviewcontroller:self];  } 

and should it!

let me know if didn't...

update!:

@captjak hey, sorry didn't work out you.. wrote following code, , works without problems here.. linked button click.. try , let me know! (ps: added animations too!).

viewcontroller *tlc = [self.storyboard instantiateviewcontrollerwithidentifier:@"mainviewcontroller"]; [tlc.view setframe:cgrectmake(-320, 0, self.view.frame.size.width, self.view.frame.size.height)];  [self addchildviewcontroller:tlc]; [self.view addsubview:tlc.view]; [tlc didmovetoparentviewcontroller:self];  [uiview animatewithduration:0.3 animations:^{     [tlc.view setframe:cgrectmake(-160, 0, self.view.frame.size.width, self.view.frame.size.height)]; }]; 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -