简体   繁体   中英

Screen is flickering on iOS 6.1.2

I am created an app, after login have to download new database from web and when you logged in a custom UIAlertView appears if user press yes the download phase will be started. When the UIAlertView disappear and the UIAlertView's delegate called i start on the background thread a download. Now i am trying to modify a label which display the current percent and adding to the view a custom activity indicator. After that when the activity indicator changing the pictures or the label.text get a new string the screen start flickering, but only at the very first start (after install), if i force close the app and starting it again the flicker thing is not appearing, on previous version of iOS the app not flicker. I am calling from main thread when i modify the label. I tried remove label and activity indicator and after the alert view disappearing the app not flicker. I tried to remove alert view and start instantly the download and after that only the status bar started to flicker.

So my question: what should i do to solve the flicker bug?

I believe that the reason is because you are updating the UI on a background thread. You must not do this, you must use the main thread for this:

To run code on the main thread from the background thread, you can use GCD:

dispatch_async(dispatch_get_main_queue(), ^{
    //your UI code here        
});

If this doesn't fix the error, it's probably a bug with your device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM