0

IOS アプリ開発学習の初心者です。最初のView Controllerとしてログイン画面があり、2番目のView ControllerをタブバーView Controllerにする必要があります。4つの異なるタブがあり、4つの異なるXIBがあります。

誰かが先に進むのを手伝ってくれます。

4

4 に答える 4

2

あなたができる最善の方法は、アプリがタブバーコントローラーの最初の画面から起動したときにログイン画面をモーダルに表示し、viewWillAppear にログイン画面を表示するためのコードを追加し、ログイン後に画面を閉じることです。このようにappDelegateでTabBarControllerを作成できます

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{


    UITabBarController tabBarController=[[UITabBarController alloc] init]; 


    FirstViewController *firstVC =  [[UIViewController alloc] initWithNibName:@"FirstVC" bundle:nil];
    UINavigationController *firstNavController = [[UINavigationController alloc] initWithRootViewController: firstVC];     

    SecondViewController *secondVC = [[UIViewController alloc] initWithNibName:@"secondVC" bundle:nil];
    UINavigationController *secondNavController = [[UINavigationController alloc] initWithRootViewController:secondVC]; 

   tabBarController.viewControllers = [NSArray arrayWithObjects: firstNavController, secondNavController, nil];

    tabBarController.selectedIndex=0;
    tabBarController.delegate = self;

UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"Movies" image:[UIImage imageNamed:@"MoviesTAB.png"] tag:1];

    [firstVC  setTabBarItem:item1];

    UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"Music" image:[UIImage imageNamed:@"musicTAB.png"] tag:2];
    [seconfVC setTabBarItem:item2];

    tabController.tabBar.translucent  = NO;
    tabController.tabBar.barStyle = UIBarStyleBlack;
    tabBarController.tintColor = [UIColor whiteColor];

    self.window.rootViewController = tabController;
return YES;
}
于 2013-11-12T10:30:38.847 に答える