添加到 UITableView 时 UIActivityIndicatorView 不起作用
我试图在等待 UITableViews 数据加载时将 UIActivityIndicatorView 添加到 UITableView 的中心。我这样做如下:
UIActivityIndicatorView *activityIndicatorTemp = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
[activityIndicatorTemp setCenter:[[self tableView] center]];
[self setActivityIndicator: activityIndicatorTemp];
[activityIndicatorTemp release];
[[self tableView] addSubview:activityIndicator];
[activityIndicator startAnimating];
但是,当我启动代码时,活动指示器根本不显示。我想以编程方式执行此操作,有关如何解决此问题或为什么它不起作用的任何建议?
I'm trying to add a UIActivityIndicatorView to the center of my UITableView while it waits for the UITableViews data to load. I am doing this as follows:
UIActivityIndicatorView *activityIndicatorTemp = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
[activityIndicatorTemp setCenter:[[self tableView] center]];
[self setActivityIndicator: activityIndicatorTemp];
[activityIndicatorTemp release];
[[self tableView] addSubview:activityIndicator];
[activityIndicator startAnimating];
However the activity indicator is not showing up at all when I launch the code. I'd like to do it programmatically, any suggestions on how to fix this or why it isn't working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请移至
addSubview之后:
please move
after addSubview:
这里的问题是当我设置活动指示器的位置时。我在初始化表视图之前就这样做了。
我删除了上面的内容并且它起作用了。
The problem here is when I was setting the location of the activityindicator. I did this before the tableview had been initialized.
I removed the above and it worked.