Monday 4 February 2013

Create A Project in TabbarController in Xcode



Step1: File --> New --> Project --> Application --> Empty Application --> Project Name --> Create.

Step2: Automatically Created Files are


Step3: And Create a New File for MainWindow.Xib (UserInterface --> Window).

Step4: Create Object And Class Name is Changed into AppDelegate.

Step5: Create the New TabbarController


Step6: Change the AppDelegate Codings are

     AppDelegate.h

             @property (strong, nonatomic) IBOutlet UIWindow *window;
            @property (strong, nonatomic) IBOutlet UITabBarController *tabbar;
            //*important --- IBOutlet

    AppDelegate.m

           @synthesize window,tabbar;

            - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
           {
                   [self.window addSubview:tabbar.view];
                   self.window.backgroundColor = [UIColor whiteColor];
                   [self.window makeKeyAndVisible];
                   return YES;
          }

Step7: Connect the Outlets are

  • MainWindow.Xib --> FileOwner --> ClassName Changed to UIApplication.
  • MainWindow.Xib --> FileOwner --> Connect Outlet --> delegate into AppDelegate.
  • MainWindow.Xib --> AppDelegate(Object) --> Connect Outlet --> Tabbar into TabbarController, window into Window.
  • Project Header --> Summary --> MainInterface --> Select MainWindow.
Step10: Tabbar Item1 Select --> Change Class into ViewController1(Example).

Step11: Tabbar Item1 Select --> Change Class into ViewController2(Example).

Step12: Add a Navigation Controller in TabbarController.

  • Navigation Controller name is Item
  • The Class is Changed into ViewController3(Example)







OutPut:

Item1                                                                    Item2

              


Item3(With Navigation Controller)



No comments: