2010-12-08 34 views

回答

2

使用的動作片,像這樣:

/* present a dialog */ 
-(void)showDialog { 
    loadingActionSheet = [[UIActionSheet alloc] initWithTitle:@"Something was saved!" delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; 
    [loadingActionSheet showInView:self.view]; 
    [NSTimer scheduledTimerWithTimeInterval:1.5f target:self selector:@selector(closeActionSheet:) userInfo:nil repeats:NO]; 
} 


/* close the actionsheet */ 
-(void)closeActionSheet:(id)sender { 
    [loadingActionSheet dismissWithClickedButtonIndex:0 animated:YES]; 
} 

在頭定義UIActionSheet *loadingActionSheet;,並使用@property & @synthesize

您還需要在頁眉中實施UIActionSheetDelegate