关于提示框的编辑
弹出框自己消失
-(void)rightrightBarButtonItemAction:(UIBarButtonItem *)sender{
UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@”提示” message:@”收藏成功” delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
[alertView show];
[alertView dismissWithClickedButtonIndex:0 animated:YES];
}
弹出框定时消失
弹出框定时消失
- (void)timerFireMethod:(NSTimer*)theTimer//弹出框
{
UIAlertView promptAlert = (UIAlertView)[theTimer userInfo];
[promptAlert dismissWithClickedButtonIndex:0 animated:NO];
promptAlert =NULL;
} - (void)showAlert:(NSString *) _message{//时间
UIAlertView *promptAlert = [[UIAlertView alloc] initWithTitle:_message message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];[NSTimer scheduledTimerWithTimeInterval:1.5f
target:self
selector:@selector(timerFireMethod:)
userInfo:promptAlert
repeats:YES];
[promptAlert show];
}
时间: 2024-10-12 12:52:21