Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7951259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:30:31+00:00 2026-06-04T02:30:31+00:00

I have a custom bar button item that I want to nudge down 5

  • 0

I have a custom bar button item that I want to nudge down 5 pixels. How would I go about doing that witht the following code. I tried to set the “y” point but keep getting syntax errors.

     [self.navigationController setNavigationBarHidden:NO animated:YES];

     UIImage *image = [UIImage imageNamed:@"arrow_back.png"];
     UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

     [self.navigationController.navigationBar addSubview:imageView];

    [imageView release];

     UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
     [button setImage:buttonImage forState:UIControlStateNormal];

     //set the frame of the button to the size of the image (see note below)
     button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);

    [button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];

     //create a UIBarButtonItem with the button as a custom view
     UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
     self.navigationItem.leftBarButtonItem = customBarItem;

    [customBarItem release];
}

thanks for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:30:32+00:00Added an answer on June 4, 2026 at 2:30 am

    A UIBarButton item doesn’t inherit from UIView so doesn’t have a “frame” property that you can adjust directly so you need to use a different method.

    Try:

        [self.navigationItem.leftBarButtonItem setBackgroundVerticalPositionAdjustment:5 forBarMetrics:UIBarMetricsDefault];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a custom button bar as described here . Now, I want
I have to create a custom compound button bar control in Android like the
friends, i have created custom title bar using following titlebar.xml file with code <?xml
Hello people I have made a custom title bar for my app. I would
I have created a flexible navigation bar in my app that will show custom
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have custom buttons in the nav bar, I want to toggle their state
At the moment I have a custom ActiveX plugin that drops down the usual
I have this application that shows an item in the system's status bar, and
I have a problem about the title bar. I want to do 2 buttons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.