开发者

iPhone Multitasking-Like Menu

开发者 https://www.devze.com 2023-01-06 14:06 出处:网络
I am trying to create a menu that slides up from the bottom of the screen just like the multitasking bar in iOS4.

I am trying to create a menu that slides up from the bottom of the screen just like the multitasking bar in iOS4. Any ideas how to do this? (I looked into UIViews and commitAnimation, but it d开发者_Go百科idnt't quite do what I needed) Are there any examples of this?


You need to add a subview to your content view, and position it just off screen. Then when you want to show it, you reposition the frame inside some UIView animation calls. Here's an example of code that I use to show a view sliding in:

-(void)showWorkoutControls {
    CGRect frame = optionsView.frame;
    frame.origin.y = 340.0;

    workoutPicker.userInteractionEnabled = NO;
    [workoutPicker hideTiles];

    [UIView beginAnimations: @"showWorkoutControls" context: nil];
    [UIView setAnimationDelegate: self];
    [UIView setAnimationDidStopSelector: @selector(animationFinished: finished: context:)];
    [UIView setAnimationDelay:0.25];
    [UIView setAnimationDuration: kAnimationDuration];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    optionsView.frame = frame;
    [UIView commitAnimations];
}


One way to do this is to create a scroll view that is larger in the vertical dimension, and make the view scroll when some event is triggered.


It's just a scroll view with image views inside. For the tap and hold, you'll have to do some UITouch work, but it's not a whole lot of work.

0

精彩评论

暂无评论...
验证码 换一张
取 消