简体   繁体   English

如何以编程方式向我的UITableViewController添加活动指示器视图?

[英]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.

相关问题 如何以编程方式在视图中间创建活动指示器? - How can I create a activity indicator in middle of view programmatically? 以编程方式将UITableViewController添加到当前视图 - Add UITableViewController to Current View Programmatically 如何绕过活动指示器背景的角 - How do I round the corners of my Activity Indicator Background 如何让我的活动指标在合适的时间开始? - How do I get my Activity Indicator to start at the right time? 如何以编程方式将UIToolbar添加到UITableViewController? - How to add a UIToolbar to a UITableViewController programmatically? 在哪里添加活动指示器视图? - Where to add activity indicator view? 将活动指示符添加到Web视图 - Add activity indicator to web view 以编程方式加载UITableViewController并将视图添加为子视图 - Load UITableViewController programmatically and add view as subview 如何在UITableViewController中显示无数据启动UIView? 从tableView添加和删除视图? - How do I display a no-data splash UIView in a UITableViewController? Add and remove view from tableView? 如何在UITableViewController顶部添加模式视图,以禁止用户与 - How do I add a modal view on top of a UITableViewController that disables user interaction with
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM