链接地址:http://blog.sina.com.cn/s/blog_4adf31ea0100pt31.html
代码如下:
@interface View21 : UIViewController <UIActionSheetDelegate> { float amountDone; UIProgressView *progressView; UIActionSheet *actionSheet; UIView *mainView; } |
实现方法:
#import "View21.h" @implementation View21 @synthesize actionSheet;
{ mainView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; self.view=mainView;
} -(void) action: (UIBarButtonItem *) item { amountDone = 0.0f; progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0.0f, 40.0f, 220.0f, 90.0f)]; [NSTimer scheduledTimerWithTimeIn
progressView.center = CGPointMake(actionSheet.center.x, progressView.center.y); }
- (void) incrementBar: (id) timer {
if (amountDone > 20.0) { [self.actionSheet dismissWithClickedButton self.actionSheet = nil; [timer invalidate]; } } } |