ios中提示信息的实现及自动消失
2014-08-22 08:56
447 查看
利用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 提示信息显示后自动消失的具体实现
- jquery 提示信息显示后自动消失的具体实现
- iOS中可以设定时间自动消失提示框的三种实现方式
- Jquery 网站保存信息提示消息实现,提示后自动消失
- Jquery 网站保存信息提示消息实现,提示后自动消失
- 实现文本框获得焦点,文本框里提示信息自动消失
- iOS中自动消失提示框的实现
- iOS中自动消失提示框的实现
- JS实现文本框获得焦点,文本框里提示信息自动消失
- JS实现文本框获得焦点,文本框里提示信息自动消失
- 还有如此实现方法,没试用过,mouseEntered一个按钮的时候如何让他自动显示按钮的注释信息在一个小的注释框中??鼠标移走又小的注释框又自动消失??
- iOS中消息框提示的出现与自动消失
- IOS——仿Android自动消失的小提示窗
- js小技巧(输入框提示信息自动消失)
- JavaScript学习笔记3--文本框获得焦点,文本框里提示信息自动消失
- 如何在iOS上实现Android风格的提示信息Toast
- ios中UIAlert 提示框自动消失方法,超简单!