[英]How to add uitabbarcontroller as a subview in UIViewController
我是 iPhone 開發的新手......現在我正在嘗試構建一個應用程序,其中首先向用戶顯示登錄屏幕。 在此視圖中沒有導航控件。
用戶登錄后,我想顯示一個具有標簽欄控件的新視圖。 基於在選項卡欄中選擇的選項卡項...正在顯示的視圖可能只有一個表格視圖或表格視圖 + 導航欄控件。
對此有什么幫助嗎?
我能夠構建一個小型應用程序來登錄屏幕並驗證用戶憑據。還有一個不同的應用程序,我在其中構建了一個 tabbarviewcontroller 並顯示將各種視圖與每個 tabbar 項相關聯。
但不確定將兩者結合起來。所以問題是我不知道如何將 UITabbarController 添加為第二個視圖
請幫助我。
你需要做這樣的事情。 從主 window 和 tabbarcontroller 的視圖中刪除登錄視圖到主 window。 您只需要在應用程序委托 class 中實現一些方法。
將 tabbatcontroller 添加到您的主窗口 class。 每當您需要在應用程序中使用tabar。 只需刪除 UINavigationController 並添加 UITabBarController。
或將添加 tabbatcontroller 添加到您的主窗口 class 並從當前視圖控制器中顯示 tababrcontroller。
AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
delegate.tCtr.selectedIndex = index;
delegate.tCtr.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:delegate.tCtr animated:YES];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.