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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -