ios中提示信息的实现及自动消失
2012-06-08 17:35
417 查看
利用UIAlertView+NSTimer可轻松实现这一功能
- (void)timerFireMethod:(NSTimer*)theTimer
{
UIAlertView *promptAlert = (UIAlertView*)[theTimer userInfo];
[promptAlert dismissWithClickedButtonIndex:0 animated:NO];
[promptAlert release];
promptAlert =NULL;
}
- (void)showAlert
{
UIAlertView *promptAlert = [[UIAlertView alloc]
initWithTitle:@"提示:" message:@"添加收藏成功!" delegate:nil
cancelButtonTitle:nil otherButtonTitles:nil];
[NSTimer scheduledTimerWithTimeInterval:0.5f
target:self
selector:@selector(timerFireMethod:)
userInfo:promptAlert
repeats:NO];
[promptAlert show];
}
延迟时间可自己调节。
- (void)timerFireMethod:(NSTimer*)theTimer
{
UIAlertView *promptAlert = (UIAlertView*)[theTimer userInfo];
[promptAlert dismissWithClickedButtonIndex:0 animated:NO];
[promptAlert release];
promptAlert =NULL;
}
- (void)showAlert
{
UIAlertView *promptAlert = [[UIAlertView alloc]
initWithTitle:@"提示:" message:@"添加收藏成功!" delegate:nil
cancelButtonTitle:nil otherButtonTitles:nil];
[NSTimer scheduledTimerWithTimeInterval:0.5f
target:self
selector:@selector(timerFireMethod:)
userInfo:promptAlert
repeats:NO];
[promptAlert show];
}
延迟时间可自己调节。
相关文章推荐
- ios中提示信息的实现及自动消失
- ios中提示信息的实现及自动消失
- iOS提示信息的实现与自动消失
- Jquery 网站保存信息提示消息实现,提示后自动消失
- iOS中自动消失提示框的实现
- JS实现文本框获得焦点,文本框里提示信息自动消失
- jquery 提示信息显示后自动消失的具体实现
- 实现文本框获得焦点,文本框里提示信息自动消失
- iOS中自动消失提示框的实现
- iOS中可以设定时间自动消失提示框的三种实现方式
- jquery 提示信息显示后自动消失的具体实现
- JS实现文本框获得焦点,文本框里提示信息自动消失
- Jquery 网站保存信息提示消息实现,提示后自动消失
- JavaScript学习笔记3--文本框获得焦点,文本框里提示信息自动消失
- iOS 提示框显示后自动消失
- Asp.net实现网站提示信息页面后的定时自动跳转到指定页面
- IOS实现消息自动消失
- js实现浏览器右下角弹出提示信息窗口,几秒后自动关闭
- JavaScript学习笔记3--文本框获得焦点,文本框里提示信息自动消失
- iOS 渐变提示。错误弹出提示 几秒自动消失