Friday 15 July 2011

objective c - UIAlertController showing with delay -



objective c - UIAlertController showing with delay -

i'm experiencing problem uialertcontroller on app migrated ios8 date picker inside.

below code.

uialertcontroller *alertview = [uialertcontroller alertcontrollerwithtitle:title message:nil preferredstyle:uialertcontrollerstyleactionsheet]; uialertaction *ok = [uialertaction actionwithtitle:@"ok" style:uialertactionstyledefault handler:^(uialertaction *action) { [alertview dismissviewcontrolleranimated:yes completion:nil]; }]; uialertaction *set = [uialertaction actionwithtitle:nslocalizedstring(@"set today", nil) style:uialertactionstyledefault handler:^(uialertaction *action) { [self set_to_today:nil]; [alertview dismissviewcontrolleranimated:yes completion:nil]; [self.tableview reloaddata]; }]; uialertaction *cancel = [uialertaction actionwithtitle:@"cancel" style:uialertactionstyledefault handler:^(uialertaction *action) { [alertview dismissviewcontrolleranimated:yes completion:nil]; }]; uidatepicker *datepicker = [[[uidatepicker alloc] init] autorelease]; datepicker.datepickermode = uidatepickermodedate; [datepicker setdate:data_appo]; [datepicker addtarget:self action:@selector(datepickervaluechanged:) forcontrolevents:uicontroleventvaluechanged]; [alertview.view addsubview:datepicker]; [alertview addaction:ok]; [alertview addaction:set]; [alertview addaction:cancel]; [self.view bringsubviewtofront:datepicker]; [self presentviewcontroller:alertview animated:yes completion:nil];

uialertcontroller , date picker shown when user select row uitableviewcontroller.

the problem following: first time users select row works fine...but if user select "cancel" , select de tate 1 time again uialertcontroller takes 2-3 seconds show up...this happens in simulator...

i'm getting crazy....this makes app have bad user experience.

any help appreciated thanks

alex

i having same issue uialertcontroller presented selecting row uitableview. first time worked fine, , when user triggered alert 1 time again there few seconds delay before alert presented.

as workaround used gcd:

dispatch_async(dispatch_get_main_queue(), ^{ [self presentviewcontroller:alertview animated:yes completion:nil]; });

it bug since -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath executed on main thread.

i submitted bug study apple: rdar://19285091

objective-c xcode swift uialertview uialertcontroller

No comments:

Post a Comment