ios AlertView弹出框, 慢慢消失

来源:互联网 发布:网络语气词有哪些 编辑:程序博客网 时间:2024/06/16 00:42
- (void)timerFireMethod:(NSTimer*)theTimer//弹出框
{
    UIAlertView *promptAlert = (UIAlertView*)[theTimer userInfo];
    [promptAlert dismissWithClickedButtonIndex:0 animated:YES];
    promptAlert =NULL;
}


- (void)showAlert:(NSString *) _message{//时间
    UIAlertView *promptAlert = [[UIAlertView alloc] initWithTitle:@"提示:" message:_message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
   
    [NSTimer scheduledTimerWithTimeInterval:1.5f
                                     target:self
                                   selector:@selector(timerFireMethod:)
                                   userInfo:promptAlert
                                    repeats:YES];
    [promptAlert show];

}

个人观点: 效果有点尴尬, 但是可以根据其他方法去自定义AlertView;

转自: http://blog.sina.com.cn/s/blog_721cd3390101voi2.html

0 0
原创粉丝点击