iphone - Calling UIAlertView clickedbutton at index Programatically -
iphone - Calling UIAlertView clickedbutton at index Programatically -
i trying phone call uialertview's delegate method programatically. here code:-
if([vc respondstoselector:@selector(alertview:clickedbuttonatindex:)]) { // manually invoke alert view button handler [(id <uialertviewdelegate>)vc alertview:nil clickedbuttonatindex:0]; }
it works fine on ios5.0 not working on ios6.0 , comments or suggestions welcomed :)
here finish method detail:-
twtweetcomposeviewcontroller *vc = [[[twtweetcomposeviewcontroller alloc] init]autorelease]; // settin initial text [vc setinitialtext:status]; [vc setcompletionhandler:^(twtweetcomposeviewcontrollerresult result) { if(result == twtweetcomposeviewcontrollerresultdone) { nslog(@"tweeted sucessfully"); } }]; if([delegate iskindofclass:[uiviewcontroller class]]){ [(uiviewcontroller *)delegate presentmodalviewcontroller:vc animated:yes]; } //alertview:clickedbuttonatindex: if([vc respondstoselector:@selector(alertview:clickedbuttonatindex:)]) { // manually invoke alert view button handler [(id <uialertviewdelegate>)vc alertview:nil clickedbuttonatindex:0]; } }
in code give alertview alertview obect name bellow..
[(id <uialertviewdelegate>)vc alertview:youralertview clickedbuttonatindex:0];
otherwise seek bellow code..
id<uialertviewdelegate> delegate = youralertview.delegate; youralertview.delegate = nil; [delegate alertview:youralertview clickedbuttonatindex:0];
see link other alternative it..
why-doesnt-dismisswithclickedbuttonindex-ever-call-clickedbuttonatindex
iphone objective-c ios5 ios6
Comments
Post a Comment