ios - Flashing screen although I do my alerts on main thread -
i know uikit stuff should done on mian thread, that's why, ensure alert view showing on main thread.
-(void)showalert:(nsstring *)alertmessage{ uialertview *alert = [[uialertview alloc] initwithtitle:alertmessage message:nil delegate:nil cancelbuttontitle:nil otherbuttontitles:@"ok", nil]; dispatch_async(dispatch_get_main_queue(), ^{ [alert show]; }); }
however, when dismiss alert, screen becomes flashing. didn't fix issue, missing something?
if calling show alert method form background thread, please try using
[self performselectoronmainthread:@selector(showalert:) withobject:alertmessage waituntildone:yes];
for method call , change showalert method
uialertview *alert = [[uialertview alloc] initwithtitle:alertmessage message:nil delegate:nil cancelbuttontitle:nil otherbuttontitles:@"ok", nil]; [alert show];
Comments
Post a Comment