I am using code to display an MBProgressHUD at the top of one of my views while downloading data from a Web -Service, the only problem is that sometimes this code hangs the app, until the HUD does not display "downloading" and the screen is locked. Besides, if I have some keyboard like that which is displayed to the user when I press the Fresh Button (downloading the refresh button) the application crashes on the line:
[Self.tableView reloadData]; My code:
is // network connection shows Czech then HUD when performing bridge and Daspledeta method - (IBAction) update {UIAlertView * ErrorView; If ([[Ricabiliti Positioning For Internet Knnekshn] Current Riibilitistats] == Notibl) {errorView = [[Uaielartwu light] Int Vithtaitl: @ "Network error" message: @ "a network connection is not available!" Representative: self cancel buttonTitle: @ "OK" other button titles: zero]; [Show error view]; } And {HUD = [[MBP progression HID Alok] Intimate sight: self. Navigation Controller See]; [Self. Navigation Controller See aidview: hud]; HUD.delegate = self; HUD.labelText = @ "Download"; HUD.minSize = CGSizeMake (135.f, 135.f); [Showing HUD: Fair: Target on @Sillector (bridge and display): Object with self: zero animated: yes]; }} // Download the user data from the Web service - (blank) bridge and Displedeta {// uncertain mode Wyidetadaunloder * Downloader = [[Wyidetadaunloder light] init]; [Download pull pull and display]; NSUserDefaults * defaults = [NSUserDefaults Standard User Default]; If ([[defaults objectForKey: @ "canExportCSVServer"] is EqualToString: @ "1"] {} [self.tableViewReloadData]; // Switch to fixed mode HUD.mode = MBProgressHUDModeDeterminate; HUD.labelText = @ "Update"; Float progress = 0.0 f; While (Progress & lt; 1.0f) {Progress + = 0.01f; HUD. Progress = progress; Usleep (15000); } // Sample Image is based on work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/. Create custom Picks 37 pixels, 37 pixels for best results HUD.customView (They build in progress indicator of limitations) = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "37x-checkmark.png"]]; HUD.mode = MBProgressHUDModeCustomView; HUD.labelText = @ "" full "; sleep (2);} There will also be greatly appreciated.
Jack
pullAndDisplayData method is running on a separate thread. this is because MBProgressHUD < / Code> can use the UI thread to show itself. You should always update your UI with the main (UI) thread. Select the display onOn MINTread: to call the method < Code> [self.tableView reloadData]; and other UI stuff I'm assuming Questions that [downloader pullAndDisplayData]; is simultaneous calls.
Comments
Post a Comment