objective c - How to pause code execution while waiting for UIAlertView response? -


i have uialertview , need decide code run according user response (depends on button user presses yes/no) i've found solutions won't work me:

to put rest of code in the

-(void)alertview : (uialertview *)alertview clickedbuttonatindex : (nsinteger)buttonindex 

function thing alert doesn't run on every execution on occasions need code in original function makes solution impossible me.

to use flag (clicked) indicates button pressed , use following line of code:

while (!clicked) [[nsrunloop currentrunloop] rununtildate:[nsdate distantfuture]]; 

but when use can't press buttons on uialert, mean, not respond. i've found bit different solution claimed works him, original code in c# in obj-c be:

while (!clicked) [[nsrunloop currentrunloop] rununtildate:[[nsdate date] datebyaddingtimeinterval:0.5]]; 

but in case same response problems.

please me make 1 of solutions work or suggest one.

thank you,

alex

the first case delegate of alertview easiest way

if(showalert==true)//there case show alert or not  { show alert implement rest of code in delegate } else { write rest of code here, if alertview not called execute } 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -