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 6338825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:31:25+00:00 2026-05-24T19:31:25+00:00

I am trying to add the image on to the UIBarButtonItem .But it is

  • 0

I am trying to add the image on to the UIBarButtonItem .But it is not getting added I don’t what’s going wrong in it this my code

-(void)viewDidLoad
{
    UIToolbar *tools = [[UIToolbar alloc]
    initWithFrame:CGRectMake(0.0f, 0.0f, 103.0f, 44.01f)]; // 44.01 shifts it up 1px for some reason
        //tools.clearsContextBeforeDrawing = YES;
        //tools.clipsToBounds = YES;
        //tools.tintColor = [UIColor colorWithWhite:0.305f alpha:0.0f]; // closest I could get by eye to black, translucent style.
        // anyone know how to get it perfect?
        //tools.barStyle = -1; // clear background
        NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:3];

        // Create a standard refresh button.
        bi = [[UIBarButtonItem alloc]
        initWithImage:[UIImage imageNamed:@"map.png"] style:UIBarButtonItemStylePlain  target:self action:@selector(changeMapType:)];
        [buttons addObject:bi];
        [bi release];

        // Create a spacer.
        bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
        bi.width = 12.0f;
        [buttons addObject:bi];
        [bi release];

        // Add profile button.
        bi = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"map.png"] style:UIBarButtonItemStylePlain target:self action:@selector(goToProfile)];
        bi.style = UIBarButtonItemStyleBordered;
        [buttons addObject:bi];
        [bi release];

        // Add buttons to toolbar and toolbar to nav bar.
        [tools setItems:buttons animated:NO];
        [buttons release];
        twoButtons = [[UIBarButtonItem alloc] initWithCustomView:tools];
        [tools release];
        self.navigationItem.rightBarButtonItem = twoButtons;
        [twoButtons release];
}

Thank you

  • 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-05-24T19:31:26+00:00Added an answer on May 24, 2026 at 7:31 pm

    You are creating your button as a UIBarButtonItemStylePlain, try:

    UIBarButtonItem *button = [[UIBarButtonItem alloc] init];
    [button setImage:[UIImage imageNamed:@"map.png"]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to add image in JLabel but it's not working. The second
I am trying to add background image for the . but It is not
I'm trying to add an image to an SVG file.. I tried this code::
I am trying to add an image to the UIBarButtonItem which I have to
I'm trying to add image tags to a WPF image and I'm not having
I'm trying to add an image as svn:externals but TortoiseSVN refuses it somehow. Currently
I'm trying to add an image in the content of an article, but I
I'm trying to add an image to my canvas but it doesn't seem to
I am trying to add image on a canvas and using Kinetic.js library but
I am simply(for you, not me) trying to add image fading to the following

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.