"Devam ediyor" diyen bir UIAlertView oluşturmak istiyorum. Ayrıca üzerinde UIActivityindicatorView olduğunu gösterecektir. Bunu nasıl yapabilirim, söyler misin?Bir UIAlertView'e UIActivityindicatorView Ekleme
Teşekkürler.
"Devam ediyor" diyen bir UIAlertView oluşturmak istiyorum. Ayrıca üzerinde UIActivityindicatorView olduğunu gösterecektir. Bunu nasıl yapabilirim, söyler misin?Bir UIAlertView'e UIActivityindicatorView Ekleme
Teşekkürler.
Oldukça basit. Sadece bir UIActivityIndicatorView oluşturun ve bunu UIAlertView'a bir alt görünüm olarak ekleyin.
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];
Bu spinner AlertView ait görevden gizlenmiş olur.
[alert dismissWithClickedButtonIndex:0 animated:YES];
Durumumda, kodlanmış çerçeve kaynaklarının kullanılmasının kötü olduğunu buldum. Mesajımın bir satırı daha varsa, mesajımın en üstünde gösteriliyor.
Yani ben layouting göstergeli işlevi oluşturursanız boyutu UIAlertView
Bu durumda+(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;
}
, gösterge daima merkez tarafından
Bir satır mesaj:
Daha bir satırlık mesaj:
Teşekkürler, işe yaradı. – ebaccount
Bu harika bir cevabı var, ancak hiç bir düğme yoksa görünümü nasıl reddedebileceğimi merak ediyorum. –
[alert offmissWithClickedButtonIndex: 0 animasyonlu: YES]; –