导入 QuartzCore 框架并为您想要的执行此操作,就像在 ios7 控制中心一样从底部出现一个窗口
- (void)viewDidLoad
{
upwardView=[[UIView alloc]init];
upwardView.backgroundColor=[UIColor blueColor];
UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipe:)];
gesture.direction = UISwipeGestureRecognizerDirectionUp;
[self.view addGestureRecognizer:gesture];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)didSwipe:(UIGestureRecognizer *)gestureRecognizer
{
[upwardView setFrame:CGRectMake(0, 265, 320, 230)];
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromTop];
[animation setDuration:.50];
[animation setDelegate:self];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
CALayer *layer = [upwardView layer];
[layer addAnimation:animation forKey:nil];
[self.view.window addSubview:upwardView];
}