I noticed that after dismiss a UIAlertView
, there is a short amount of time that apps do not recognize any touches.
So, I made a very simple project, which only contains 2 UIButton
s (one to change a label
to a random number and one to show a UIAlertView
).
Tested it both on device (an iPhone4) and simulator (iOS 6 and iOS 7). The result is this lag only happens on iOS 7. On iOS 6.x, it works just fine.
The delay duration depends on how large the app is. In the test project, which I described above, the delay is about 0.3s. However, in an another project of mine, it maybe up to 1 second.
I also used GCD
, follow this:
- (void) startSomeLongOperation {
//display alertView
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_NORMAL, 0), ^{
// …do something that takes long…
dispatch_async(dispatch_get_main_queue(), ^{
//dismiss alertView
});
});
}
another one I have tried:
dispatch_async(dispatch_get_main_queue(), ^{
//show and dismiss alertView
});
neither of them work.
So, I jumped in to conclusion that this delay was caused by iOS 7.
Have anyone experienced this before ?