[英]two ViewControllers for one tab in a tabBarController
我有一個tabBarController(我是使用不帶Interface Builder的代碼創建的):
self.tabBarController = [[[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstController, secondController, thirdController, nil];
當我在第二個選項卡(secondController)中並且按下按鈕時:
UIButton *button1;
我想傳遞到另一個視圖(例如,seconddController):
- (void)actio:(UIButton *)button1
{
seconddController *scdd = [[seconddController alloc] init ];
[self presentModalViewController:scdd animated:YES];
}
但是問題是我想保留在第二個選項卡上,而不是視圖占據所有空間,所以如何將seconddCntroller添加到第二個選項卡上來代替secondController?
謝謝
如果我理解正確,則需要由導航控制器管理secondController
,以便其結構為:
self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstController, secondNav, thirdController, nil];
然后你可以使用pushViewController:animated:
顯示scdd
超過secondController
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.