ios - How to implement a custom NavigationViewController? -
i want implement navigationviewcontroller, uinavigationviewcontroller, no navigationbar , custom push effect.
i know should add view controllers navigationcontroller childviewcontroller, , add views navigationcontroller's view. however, can't handle life cycle methods well, meaning when push , pop viewcontroller, viewwillappeaer viewdiddisapper , other methods should call @ proper time.
i try in popviewcontroller::
// life cycle currentvc.viewwilldisappear(animated) previousvc.viewwillappear(animated) currentvc.willmovetoparentviewcontroller(nil) uiview.animatewithduration(self.durationofpop, delay: 0, options: uiviewanimationoptions.curveeaseout, animations: { () -> void in // animations let width = currentvc.view.frame.width currentvc.view.frame = self.view.frame.rectbyoffsetting(dx: width, dy: 0) previousvc.view.frame = self.view.bounds }) { (finished) -> void in if finished { // life cycle currentvc.view.removefromsuperview() currentvc.removefromparentviewcontroller() currentvc.didmovetoparentviewcontroller(nil) previousvc.viewdidappear(animated) // self.viewcontrollers.removelast() } } i call viewwilldisappear: explicitly let called. has problems when vc has child vc.
i tried transformfromviewcontroller:toviewcontroller... method. let viewwillappear execute within animation block.
Comments
Post a Comment