2011-05-13 71 views
1

我有一个标签栏控制器,它是以编程方式创建的,名为TPastJourneyTabbar。当我点击表格视图并调用didSelectRowAtIndexPath:时,我的标签栏类应该被分配,并且应该被添加为另一个类的子视图。我已经做到了这一点使用follwing代码:标签栏作为视图控制器顶层视图的子视图;绘制得不正确

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
    TPastJourneyTabBar * tabbar = [[TPastJourneyTabBar alloc]init]; 

    HGMovingAnnotationSampleViewController *detailViewController = [[HGMovingAnnotationSampleViewController alloc] initWithNibName:@"HGMovingAnnotationSampleViewController" bundle:nil]; 
    [detailViewController.view addSubview:tabbar.view]; 
    [self.navigationController pushViewController:detailViewController animated:YES]; 

    [detailViewController release]; 

} 

HGMovingAnnotationSampleViewController是类到我加入我的标签栏作为一个子视图。 当我运行我的应用程序时,标签栏被调用,但它没有完全调用;即没有看到标签栏项目的标题被写入的标签栏的下部。我怎样才能使标签栏完全可见?请帮我解决这个问题。谢谢。

回答

2

这里有一个设计问题。您不应该使用TabBar作为子视图,而不是AppDelegate的窗口,如Human Interface Guidelines所述。

相关问题