UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
indicator.center = self.view.center;
[self.view addSubview:indicator];
[indicator bringSubviewToFront:self.view];
[UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE;
schreiben Code unten, wenn Sie wollen Indikator zeigen
[indicator startAnimating];
schreiben Code unten, wenn Sie Anzeige ausblenden möchten
[indicator stopAnimating];
bei How to programmatically add a simple default loading(progress) bar in iphone app
UPD gefunden wurde : Sie können Alarmdialog ohne Sie erstellen t Tasten und fügen Sie alle benutzerdefinierten Elemente manuell:
UIAlertView *alert;
...
alert = [[UIAlertView alloc] initWithTitle:@"\n\nConfiguring Preferences\nPlease Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil]; //display without any btns
// alert = [[UIAlertView alloc] initWithTitle:@"\n\nConfiguring Preferences\nPlease Wait..." message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: nil]; //to display with cancel btn
[alert show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// Adjust the indicator so it is up a few pixels from the bottom of the alert
indicator.center = CGPointMake(alert.bounds.size.width/2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
Alarm zu entlassen, nur tun
[alert dismissWithClickedButtonIndex:0 animated:YES];
Weitere Informationen unter: http://iosdevelopertips.com/user-interface/uialertview-without-buttons-please-wait-dialog.html
seit IOS 9.0 UIAlertView ist veraltet. Folgen Sie [this] (http://stackoverflow.com/a/25671652/6042879) für eine aktualisierte Antwort! –
Probieren Sie diese HUD-Bibliothek für iOS in swift https://github.com/shubh10/JustHUD –