我的應用程序與稱爲TaskController : UINavigationController
作爲爲根視圖控制器UINavigationController
根控制器開始,我創建TaskRootController : UIViewController<UITableViewDelegate>
類(它已添加爲視圖UITableView
); 當我啓動應用程序時,我只看到標題表單TaskRootController和它的背景顏色。 但我沒有看到表格視圖。 如果我的申請以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
發佈您的代碼。如何設置rootViewController? – 2013-03-20 05:04:33
@PratyushaTerli:返回+1! – 2013-03-20 05:05:17
@Manohar謝謝 – 2013-03-20 05:06:01