iphone - Returning a BOOL value from alertview delegate method: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -



iphone - Returning a BOOL value from alertview delegate method: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -

i added tabbar controller on mainwindow.xib displaying 5 tabs , have tab bar controller's delegate method: shouldselectviewcontroller in app delegate returns boolean value (yes or no).

in delegate method, showing alert user (if user going tab 1 other tab). alert contains 2 buttons: ok , cancel.

if user clicks on ok, want delegate method homecoming yes (so user can go other tabs) , if user has selected cancel (in case wants remain on tab 1 only), want method homecoming no.

so, want shouldselectviewcontroller method stop executing till time alert nowadays on screen. there way can homecoming bool alert view's delegate method may, in turn, returned shouldselectviewcontroller or threading solution may of utilize situation??

try this

in .h

uiviewcontroller *tmpcontroller;

in .m

-(bool)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller { tmpcontroller = viewcontroller; uialertview *alert = [[uialertview alloc] initwithtitle:@"title" message:@"message" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil]; [alert show]; [alert release]; homecoming no; } -(void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex { if (buttonindex) { self.tabbarcontroller.selectedviewcontroller = tmpcontroller; } }

iphone ios uitabbarcontroller uialertview

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -