How to slide in a UIView in a portrait mode application?
-
22-02-2021 - |
题
I am working on an iPhone application that runs in portrait mode only. This app have only view controller and 1 interface file (.xib). I want to slide in some additional views when user taps on button on either toolbar / navigation bar. Let's say like info button on navigation bar. When I click it UIView should slide in from bottom. And when user taps on done button on that view that view slides down. I have made separate uiview for those views in same xib. I also looked into couple of transition examples by others but could not got that concept. Can any one give me some pointers on this ?
解决方案
You can reset the frames through animation like
UIView *view= [[UIView alloc] initWithFrame:CGRectMake(0.0f,-100.0f,320.0f,100.0f)];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:[self view] cache:YES];
[view setFrame:CGRectMake(0.0f,0.0f,320.0f,100.0f)];
[UIView commitAnimations];
其他提示
I think you mean modal view transitions. Like what the app store does when you enter a gift card on the iPhone.
Example:
UIViewController *controllerForSecondView = ..;
controllerForSecondView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:controllerForSecondView animated:YES];
Then make a done button in the second xib and call:
dismissModalViewController