ios - Using NSRunLoop to block proceeding works on Simulator but fail on device -


here have uialertview,it appears within nsrunloop, want program proceeding blocked when appears, after clicked "ok" button, program carries on. tried 2 methods

1.in lbalertview.h

@interface lbalertview : uialertview <uialertviewdelegate> {     bool iswaiting4tap; }  @property(nonatomic,assign) bool iswaiting4tap;  - (void)showmodal;  @end   

in lbalertview.m

- (void)showmodal {     iswaiting4tap = yes;     [self show];     while (self.iswaiting4tap)      {     [[nsrunloop currentrunloop] runmode:nsdefaultrunloopmode beforedate:[nsdate     distantfuture]];     } } 

in delegate place

- (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex {     switch (alertview.tag) {         case 0:         {             self.tipview.iswaiting4tap = 0;             [((lbsceneview*)self.delegate).theball initball];         }             break;          default:             break;     }   } 

where tipview object of lbalertview.

2.in lbalertview.m

- (void)showmodal {         [self show];     cfrunlooprun();  } 

in delegate place

- (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex {     switch (alertview.tag) {         case 0:         {             cfrunloopstop(cfrunloopgetcurrent());              [((lbsceneview*)self.delegate).theball initball];         }             break;          default:             break;     }   } 

both methods works on simulator fails on device, lbalertview pops out on , on again, seems program not blocked @ all, can figure out why, thanks


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -