我的应用程序从根控制器开始,称为我创建TaskController : UINavigationController
的类的根视图控制器(它已添加为视图);当我启动应用程序时,我只看到TaskRootController 的标题和它的背景颜色。但我没有看到表格视图。如果我的应用程序以I see table view 开头。UINavigationController
TaskRootController : UIViewController<UITableViewDelegate>
UITableView
TaskRootController
rootViewController
在可能的情况下如何查看表格视图?
编辑
@implementation TaskRootController
@synthesize taskRootView; //table view
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"SIZE x:%f,y:%f ; %f:%f", self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.bounds.size.width, self.view.bounds.size.height);
self.view.backgroundColor = [UIColor grayColor];
self.title = @"Root";
self.taskRootView = [[UITableView alloc] initWithFrame: self.view.bounds style:UITableViewStylePlain];
[self.view addSubview:self.taskRootView];
self.taskRootView.delegate = self;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat result = 20.0f;
if([tableView isEqual:self.taskRootView])
{
result = 40.0f;
}
return result;
}
@end