[英]How do I add an activity indicator view to my UITableViewController programmatically?
I have a UITableViewController
that I need to add an activity indicator view to. 我有一个UITableViewController
,我需要向其中添加活动指示器视图。 I want the activity indicator to animate until the tableview has loaded. 我希望活动指示器能够动画化,直到加载tableview。 I've tried [self.view addSubview:self.activityIndicator];
我已经尝试过[self.view addSubview:self.activityIndicator];
but it doesn't appear. 但它没有出现。 What should the activity indicator's parent view be? 活动指示器的父视图应该是什么?
I'm not sure which part of this solved my problem, but I think it was giving the activity indicator view a frame that fixed it. 我不确定哪一部分解决了我的问题,但我认为它为活动指示器视图提供了一个解决问题的框架。
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
activityIndicator.center = self.view.center;
[self.view addSubview:activityIndicator];
[activityIndicator startAnimating];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.