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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:46:01+00:00 2026-05-29T07:46:01+00:00

I have been trying to get around setting navigationitem button’s width property but couldn’t

  • 0

I have been trying to get around setting navigationitem button’s width property but couldn’t find a way to get it done what exactly I am looking for.

Following code works fine setting button size what I want and appear nicely but I don’t see actually button, its rather only my image. It should appear like button and it has background image!

UIButton *addCommentButton = [UIButton buttonWithType:UIButtonTypeCustom];
[addCommentButton setFrame:CGRectMake(0, 0, 25, 25)];
[addCommentButton addTarget:self action:@selector(addComment) forControlEvents:UIControlEventTouchUpInside];
[addCommentButton setBackgroundImage:[UIImage imageNamed:@"myImage.png"] forState:UIControlStateNormal];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:addCommentButton];

Following code does that, but I can’t set button size (25,25)!!

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"myImage.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(addComment)];

I tried setting width explicitly but it does make no difference!

[[self.navigationItem rightBarButtonItem] setWidth] = 25;

Can someone please help me to sort out this issue. Thanks.

  • 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-29T07:46:01+00:00Added an answer on May 29, 2026 at 7:46 am

    I don’t have a quick explanation to fix your issue, but I think the code posted in the following link will help you solve it.

    Customization of UINavigationBar and the back button

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get my head around this but it hasn't been
I have been trying to get around this error for a day now and
I'm learning mysql and have been trying to get this working, but an error
I have been searching around for answers, but I can't seem to find anything.
I have been trying to get more in to TDD. Currently keeping it simple
I have been trying to get yui-css grid system to make a three column
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr =
I have been trying to get this one section of my UI to immediatly
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/

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.