将UIView作为子视图添加到UITableViewController的视图中

时间:2011-06-04 14:30:52

标签: objective-c cocoa-touch ios uitableview subview

我正在尝试通过以下代码将子视图添加到UITableViewController的视图

//In a UITableViewController Implementation file
self.loadingPageView = [[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame] autorelease];
self.loadingPageView.frame = self.view.bounds;

self.loadingPageView.backgroundColor = [UIColor darkGrayColor];

[self.view addSubview:loadingPageView];

运行后,我得到以下显示

Image of empty table view on iPad simulator

在将UIView添加为子视图后,有没有办法完全隐藏表格视图?

1 个答案:

答案 0 :(得分:1)

我不确定你是否可以在tableViewController的视图中添加内容。 我会将tableViewController.tableView和loadingPageView添加到一个superview。