iOS 日常开发随笔

iOS 系统弹窗 自动消失

2017-06-16  本文已影响31人  阿狸先森丶12138

-(void)showAlertView:(NSString*)message

{

UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil

message:message

delegate:nil

cancelButtonTitle:nil

otherButtonTitles:nil, nil];

[toast show];

double duration = 1;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

[toast dismissWithClickedButtonIndex:0 animated:YES];

});

}

上一篇下一篇

猜你喜欢

热点阅读