Ich möchte eine UIAlertView erstellen, die sagt "... in progress". Es wird auch zeigen, dass UIActivityindicatorView darauf. Kannst du mich wissen lassen, wie ich das machen kann?Hinzufügen von UIActivityindicatorView in einer UIAlertView
Danke.
Ich möchte eine UIAlertView erstellen, die sagt "... in progress". Es wird auch zeigen, dass UIActivityindicatorView darauf. Kannst du mich wissen lassen, wie ich das machen kann?Hinzufügen von UIActivityindicatorView in einer UIAlertView
Danke.
Es ist ziemlich einfach. Erstellen Sie einfach eine UIActivityIndicatorView und fügen Sie sie als Unteransicht der UIAlertView hinzu.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" " message:@" " delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[alert addSubview:progress];
[progress startAnimating];
[alert show];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.center = CGRectMake(xcords, ycords, width, height);
[alert addSubview:spinner];
[spinner startanimating];
[alert show];
wird auf abtun von Alertview Dieser Spinner versteckt.
In meinem Fall fand ich, was mit hartcodierten Frame-Ursprungs ist es schlecht. Und wenn meine Nachricht mehr als eine Zeile enthält, zeigt die Anzeige den Anfang meiner Nachricht an.
So erstellen i-Funktion mit Layouten Kennzeichen, wenn Größe UIAlertView
+(UIAlertView*) progressAlertWithTitle:(NSString*) title andMessage:(NSString*) message andDelegate:(id)delegate{
UIAlertView *progressAlert = [[UIAlertView alloc] init];
[progressAlert setTitle:title];
[progressAlert setMessage:message];
[progressAlert setDelegate:delegate];
UIActivityIndicatorView *progress=nil;
progress= [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[progressAlert addSubview:progress];
[progress startAnimating];
[progressAlert show];
progress.frame=CGRectMake(progressAlert.frame.size.width/2-progress.frame.size.width, progressAlert.frame.size.height-progress.frame.size.height*2, progress.frame.size.width, progress.frame.size.height);
return progressAlert;
}
In diesem Fall Indikator immer von Mitte
Eine Zeile Nachricht:
Mehr eine Zeilennachricht:
Danke, es hat funktioniert. – ebaccount
Es ist eine gute Antwort, aber ich frage mich, wie kann ich es aus der Sicht ablehnen, wenn es keine Taste gibt? –
[Warnung kündigenWithClickedButtonIndex: 0 animiert: YES]; –