0
我正在嘗試向我的應用程序添加下載進度視圖,並且它在調試預覽中顯示時並未實際顯示在設備上。任何人都可以向我解釋這個嗎?ActivityView未顯示
這裏是調試的截圖和一些代碼:
- (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];
}
'updateDownloadProgressWithBatchIndex'是如何被調用的? – matt
它在下載開始時從相同類中的方法調用,並且該類是視圖控制器。 – linuxer
這不是我要問的。我要求你_顯示code_。如果該方法繼續進行更多工作,活動視圖可能永遠不會出現。這不是你想要弄清楚的嗎? – matt