iOS UIActivityIndicatorView和UIProgressView控件
发布日期:2021-05-14 01:35:56 浏览次数:15 分类:精选文章

本文共 2335 字,大约阅读时间需要 7 分钟。

UIActivityIndicatorView ��� UIProgressView ������

UIActivityIndicatorView ��� UIProgressView ������������������������������������

UIActivityIndicatorView ������

UIActivityIndicatorView������������������������������ startAnimating ���������������������stopAnimating ������������������

���������

  • activityIndicatorViewStyle���������������������
  • hidesWhenStopped���������������������������������:YES
  • color������������������������

���������������

UIActivityIndicatorView * activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];
activityIndicatorView.hidesWhenStopped = NO;
[self.view addSubview:activityIndicatorView];
[activityIndicatorView startAnimating];
UIActivityIndicatorView * largeActivityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(220, 100, 50, 50)];
largeActivityIndicatorView.color = [UIColor magentaColor];
if (@available(iOS 13.0, *)) {
largeActivityIndicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge;
}
[self.view addSubview:largeActivityIndicatorView];
[largeActivityIndicatorView startAnimating];
dispatch_time_t stopTime = dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC);
dispatch_after(stopTime, dispatch_get_main_queue(), ^(void) {
[activityIndicatorView stopAnimating];
[largeActivityIndicatorView stopAnimating];
});

IOS 13���������������������������������UIActivityIndicatorView

UIProgressView ������

UIProgressView ���������������������������������������������������������������

���������

  • progressViewStyle������������������
  • progress���������������0.0-1.0���
  • progressTintColor������������������
  • trackTintColor������������������
  • progressImage������������������������
  • trackImage������������������������

���������������

UIProgressView * progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(50, 100, 200, 50)];
progressView.progress = 0.3;
[self.view addSubview:progressView];
UIProgressView * barProgressView = [[UIProgressView alloc] initWithFrame:CGRectMake(50, 150, 200, 50)];
barProgressView.progress = 0.3;
barProgressView.progressViewStyle = UIProgressViewStyleBar;
barProgressView.progressTintColor = [UIColor greenColor];
barProgressView.trackTintColor = [UIColor redColor];
[self.view addSubview:barProgressView];

UIProgressView ���������������������������������������������������

上一篇:iOS UIPickerView和UIDatePicker控件
下一篇:iOS UISlider和UIStepper控件

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2025年04月10日 09时03分08秒