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所述。

相關問題