私のアプリケーションは、作成したクラスTaskController : UINavigationController
のルート ビュー コントローラーとして呼び出されるルート コントローラーから始まります(ビューとして追加されます)。アプリケーションを起動すると、TaskRootController からのタイトルと背景色のみが表示されます。しかし、テーブルビューが表示されません。アプリケーションがas で始まる場合、テーブル ビューが表示されます。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