ios7 - How to present a half modal view controller over the top with iOS 7 custom transitions -
how go presenting "half view" controller on top of main view controller?
requirements: - present second view controller slides on top of main view controller. - second view controller should show on half of main view controller - main view controller should remain visible behind second view controller (transparent background, not showing black underneath) - second view controller should animate in animation similar modal vertical cover, or ios 7 custom transition - user can still interact buttons on main view controller when second view controller active (i.e. second view controller not cover entire main view controller)r - second view controller has own complex logic (cannot simple view) - storyboards, segues, ios 7 - iphone only, not ipad.
i have tried modal view controller, not allow interaction main view controller. can provide example of how ios7 custom transition or method.
one way add "half modal" controller child view controller, , animate view place. example, created "half modal" controller in storyboard frame that's half height of 4" iphone screen. use more dynamic methods account different screen sizes, should started.
@interface viewcontroller () @property (strong,nonatomic) uiviewcontroller *modal; @end @implementation viewcontroller - (ibaction)togglehalfmodal:(uibutton *)sender { if (self.childviewcontrollers.count == 0) { self.modal = [self.storyboard instantiateviewcontrollerwithidentifier:@"halfmodal"]; [self addchildviewcontroller:self.modal]; self.modal.view.frame = cgrectmake(0, 568, 320, 284); [self.view addsubview:self.modal.view]; [uiview animatewithduration:1 animations:^{ self.modal.view.frame = cgrectmake(0, 284, 320, 284);; } completion:^(bool finished) { [self.modal didmovetoparentviewcontroller:self]; }]; }else{ [uiview animatewithduration:1 animations:^{ self.modal.view.frame = cgrectmake(0, 568, 320, 284); } completion:^(bool finished) { [self.modal.view removefromsuperview]; [self.modal removefromparentviewcontroller]; self.modal = nil; }]; } }
Comments
Post a Comment