objective c - How to slide child view controllers contained inside a UIViewController in iOS? -


here's current screen:

my bookings screen

this screen consists of uiviewcontroller programatically created buttons current bookings , old bookings. have logic on how make tapped active adding uiview subview uibutton.

all space below buttons occupied container view want add different uiviewcontrollers based on button active.

initially, load 1 of view controllers when parent view appears,

drmcurrentbookingsviewcontroller *cbvc = [self.storyboard instantiateviewcontrollerwithidentifier:@"currentbookingscontroller"]; [self addchildviewcontroller:cbvc]; // 64 height of navigation bar cbvc.view.frame = cgrectmake(0, 64+50, self.view.bounds.size.width, self.view.bounds.size.height-50); [container addsubview:cbvc.view]; [cbvc didmovetoparentviewcontroller:self]; 

then, when user taps on different button, use code switch views.

drmcurrentbookingsviewcontroller *newcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"currentbookingscontroller"]; drmoldbookingsviewcontroller *oldcontroller = [self.childviewcontrollers objectatindex:0];          [oldcontroller willmovetoparentviewcontroller:nil];         [self addchildviewcontroller:newcontroller];          [self transitionfromviewcontroller:oldcontroller                           toviewcontroller:newcontroller                                   duration:0.5                                    options:uiviewanimationoptiontransitionnone                                 animations:^{                                     // no further animations required                                     newcontroller.view.frame = oldcontroller.view.frame;                                 }                                 completion:^(bool finished) {                                     [oldcontroller removefromparentviewcontroller];                                      [newcontroller didmovetoparentviewcontroller:self];                                 }]; 

but, want child views slide left-right or right-left depending on button tapped , not want select pre-defined uiviewanimationoption. i not wish fade in views. views have slide 1 end other.

how can achieve this?

thanks help.

i don't think "left right" , "right left" available apple build in animations. think should use 2 container view , use [uiview animationwithduration: method create "left right" animation


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -