Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Different functionality related to NavigationBar .

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 364
    Comment on it

    Here are listed some of the functionalities that can be implemented on navigationBar:-

    The below code will Hide the back button from NavigationBar :-

    self.navigationItem.hidesBackButton = YES;

    Thie below code will Set background image to the navigationBar.. This can be implemented by adding the code in AppDelegate method as following :-

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
     [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"top_baar_image] forBarMetrics:UIBarMetricsDefault];
       
        return YES;
    }


    To add a UIButton programatically to navigationBar and also set its TextColor :-

    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@Button_Title style:UIBarButtonItemStylePlain target:self action:@selector(back:)];
        
    self.navigationItem.rightBarButtonItem=backButton;
    
      [backButton setTintColor:[UIColor redColor]];


     Define the selector method :-

    -(void)back:(UIBarButtonItem *)sender {
       NSLog(@"Your code for button action");
        
    }


    The below code will remove the back navigation title :-

    self.navigationController.navigationBar.topItem.title = @"";


    Set the title of navigationItem :-

    self.navigationItem.title = @"The title";


    Thie below code will Change the background color of navigationBar :-

    navigationController.navigationBar.barTintColor = [UIColor greenColor];

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: