ios - How to accomplish a "90% slide" between two UIViews -
i have particular scenario i'm trying emulate and, being new cocoa touch, i'm not sure of best way accomplish it. pardon lacking tactical knowledge; clear exposition help.
what i'd emulate:
the app i'm looking @ (in particular) beat. below example of 1 of uiviews - in particular, notice gear icon settings @ bottom.
when gear touched or swiped up, 2 primary uiview changes occur:
- the original uiview slid screen 90% of way (the key point being not slide all way up).
- a new uiview slid fill newly vacated 90% space.
this basic functionality accomplish.
implementation idea #1: single uiviewcontroller w/ multiple uiviews
at first, considered having single uiviewcontroller manage both "main" , "settings" views. in case, simple thing transition these views in appropriate manner.
that said, seems bit cluttered me. depending on how robust 2 sets of functionality are, that's recipe overload single uiviewcontroller. might tell me that's okay, off bat, seems much.
implementation idea #2: multiple uiviewcontrollers within custom container viewcontroller
this route i'm going down. separates 2 discrete sets of functionality separate uiviewcontrollers (contained within container viewcontroller) , transitions between 2 via:
- (void)flipfromviewcontroller:(uiviewcontroller *)fromcontroller toviewcontroller:(uiviewcontroller *)tocontroller { cgfloat width = self.view.frame.size.width; cgfloat height = self.view.frame.size.height; fromcontroller.view.frame = cgrectmake(0.0f, 0.0f, width, height); tocontroller.view.frame = cgrectmake(0.0f, height, width, height); [self addchildviewcontroller:tocontroller]; [fromcontroller willmovetoparentviewcontroller:nil]; [self transitionfromviewcontroller:fromcontroller toviewcontroller:tocontroller duration:0.5f options:uiviewanimationoptiontransitionnone animations:^(void) { fromcontroller.view.frame = cgrectmake(0.0f, -(height - 100.0f), width, height); tocontroller.view.frame = cgrectmake(0.0f, 100.0f, width, height); } completion:^(bool finished) { [fromcontroller removefromparentviewcontroller]; [tocontroller didmovetoparentviewcontroller:self]; }]; }
the problem transition: doesn't seem stop "90% of way". looks more it's intended completely transition out "old" controller , in "new" controller, though frame adjustments on 2 uiviews not supposed "complete" moves.
where i'd guidance
i'm not asking complete solution - expertise expensive. :) said, being new this, love insight on right approach be. please let me know if can provide further information.
thanks!
i think 2nd method on right track, , intuition using transitionfromviewcontroller:toviewcontroller right -- wouldn't use method if want both view controllers present , active. so, have controller gear view child view controller of custom container controller, add second child off screen bottom have. animate both views using animatewithduration:... @ end of that, animation, should have want, , container controller have 2 children.
Comments
Post a Comment