Search code examples
iphoneiosmultiview

Complex multiview iphone ios


i need to implement a multiview app really complex to me and i need some advice. The multiview app is something like:

First view: Normal UIViewController with one button, when i push it go to second view Second view(aka mainview): a Windows with Tab Bar with 2 tabbar item who switch between: Second view A: Normal UIViewController with some elements Second view B: UITableViewController

Can someone give me an advice where to start reading or some examples?

thx


Solution

  • You need to start with view based application. And then create a UITabbarController in you appDelegate file.

    Appdelegate.h

    UITabBarController *tabBarController;
    // set properties

    Appdelegate.m

    // Synthsize

    tabBarController = [[UITabBarController alloc] init];  
        tabBarController.delegate=self;  
    
    //Adding Search,Nearby,Map,AboutUs,Favorites Tabs to tabBarController  
    Search * search = [[Search alloc] init];  
    UINavigationController *searchNav = [[UINavigationController alloc] initWithRootViewController:search];  
    
    Nearby* nearby = [[Nearby alloc] init];  
    UINavigationController *nearbyNav = [[UINavigationController alloc] initWithRootViewController:nearby];  
    
    Map* map = [[Map alloc] init];  
    UINavigationController *mapNav = [[UINavigationController alloc] initWithRootViewController:map];  
    
    AboutUs* aboutUs = [[AboutUs alloc] init];  
    UINavigationController *aboutUsNav = [[UINavigationController alloc] initWithRootViewController:aboutUs];  
    
    Favorites* favorites = [[Favorites alloc] init];  
    UINavigationController *favoritesNav = [[UINavigationController alloc] initWithRootViewController:favorites];  
    
    NSArray* controllers = [NSArray arrayWithObjects:searchNav,nearbyNav,mapNav,aboutUsNav,favoritesNav, nil];  
    tabBarController.viewControllers = controllers;  
    
    [window addSubview:tabBarController.view];    
    

    You can accordingly manage in which tab you want to place navigation controller or only a view controller.

    Then in each of the view controllers mentioned above you need to implement
    - (id)init {}
    in which you can set Tab name and image.