Wednesday, April 24, 2013

Tab Bar Application Part 2

   Tab Bar Application Part 2

Step 1

create again  the previous project 
                               Tab Bar Application Part 1

Step 2

add "tab bar item images" to your project


Step 3

click the "FirstTabView.m" 



change the code like this

//
//  FirstTabView.m
//  TabBarExample
//
//  Created by Apple on 4/24/13.
//  Copyright (c) 2013 Dhanushka Adrian. All rights reserved.
//

#import "FirstTabView.h"

@interface FirstTabView ()

@end

@implementation FirstTabView

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
       
        // Set the Title Name of Title Bar
        self.title = @"First";
        // Set the Tab Image of Tab Bar which belongs to view
        self.tabBarItem.image = [UIImage imageNamed:@"icon1"];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

Run the app & check what happen

like that do to other " .m " files also

Important

"ViewController.m" didn't have this method

"- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil"


then you have to copy paste the that same code into " ViewController.m " 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
       
        // Set the Title Name of Title Bar
        self.title = @"Fourth";
        // Set the Tab Image of Tab Bar which belongs to view
        self.tabBarItem.image = [UIImage imageNamed:@"icon4"];
    }
    return self;
}


Step 4

Run your App


























No comments:

Post a Comment