gpt4 book ai didi

ios - ActivityView 不显示

转载 作者:行者123 更新时间:2023-11-29 01:33:23 25 4
gpt4 key购买 nike

我正在尝试向我的应用程序添加下载进度 View ,虽然它显示在调试预览中,但实际上并没有显示在设备上。谁能给我解释一下?

这是调试的屏幕截图和一些代码:

enter image description here

- (void)updateDownloadProgressWithBatchIndex:(int)index contentName:(NSString *)name
{
CGSize size = self.view.bounds.size;

_loadingView = [[UIView alloc] initWithFrame:CGRectMake(75, 155, 170, 170)];
_loadingView.backgroundColor = [UIColor blackColor];
_loadingView.clipsToBounds = YES;
_loadingView.layer.cornerRadius = 10.0;
[_loadingView setCenter:CGPointMake(size.width/2, size.height/2)];

_activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
_activityView.frame = CGRectMake(65, 40, _activityView.bounds.size.width, _activityView.bounds.size.height);
_activityView.hidden = NO;
[_activityView setCenter:CGPointMake(size.width/2, size.height/2)];
[_loadingView addSubview:_activityView];

_loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 115, 130, 22)];
_loadingLabel.backgroundColor = [UIColor clearColor];
_loadingLabel.textColor = [UIColor whiteColor];
_loadingLabel.adjustsFontSizeToFitWidth = YES;
_loadingLabel.textAlignment = UITextAlignmentCenter;
_loadingLabel.text = [NSString stringWithFormat:@"Batch %i downloading...", index];
[_loadingView addSubview:_loadingLabel];

[self.view addSubview:_loadingView];
_loadingView.hidden = NO;
UIView *v = self.view;
[_activityView startAnimating];
}

最佳答案

我将大胆猜测 - 它必须是疯狂的,因为您拒绝显示您的代码 - 在您调用 updateDownloadProgress 后,您将继续进行同步网络。这就是问题的原因。因此,事件 View 无法开始旋转将是诊断性的,真正的问题是同步网络,这是一个禁忌。

关于ios - ActivityView 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33219471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com