Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create a custom back button in iOS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 481
    Comment on it

    Some times we need to create a custom back button for Navigation Bar in iOS. If you want to create an easy navigational back button instead of creating a view and add that view in navigation bar then use below code to achieve it.

    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *backBtnImage = [UIImage imageNamed:@"back.png"];
    [backBtn setImage:backBtnImage forState:UIControlStateNormal];
    backBtn.frame = CGRectMake(0, 0, 35, 40);
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:backBtn] ;
    self.navigationItem.leftBarButtonItem = backButton;
    

    Above code will override default navigation back button with above customized button. Happy Coding!!!

 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: