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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:34:53+00:00 2026-06-07T06:34:53+00:00

NOTE: I can get this to work by switching leftbarbuttonitem to rightbarbutton item in

  • 0

NOTE: I can get this to work by switching leftbarbuttonitem to rightbarbutton item in my barbutton and barbutton2 methods. I’m just curious to know why it won’t work normally!

For some strange reason, my leftbarbuttonitem is showing, but my rightbarbuttonitem just never pops up! Here’s my code

    -(void)barButton {
    image = [UIImage imageNamed:@"BBut.png"];

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage: [image stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateNormal];
    [button setBackgroundImage: [[UIImage imageNamed: @"BBut.png"] stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateHighlighted];

    [button addTarget:self action:@selector(showlocations:) forControlEvents:UIControlEventTouchUpInside];
    button.frame= CGRectMake(3.0, 0.0, image.size.width+1, image.size.height+0);

    UIView *v=[[UIView alloc] initWithFrame:CGRectMake(3.0, 0.0, image.size.width+1, image.size.height) ];

    [v addSubview:button];

    UIBarButtonItem *modal = [[UIBarButtonItem alloc] initWithCustomView:v];
    self.navigation.leftBarButtonItem = modal;


-(void)barButton2 {
    image2 = [UIImage imageNamed:@"Refresh.png"];

    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    [button2 setBackgroundImage: [image2 stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0] forState:UIControlStateNormal];
    [button2 setBackgroundImage: [[UIImage imageNamed: @"Refresh.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0] forState:UIControlStateHighlighted];
        // [button2 addTarget:self action:@selector(viewDidLoad) forControlEvents:UIControlEventTouchUpInside];
    button2.frame= CGRectMake(281.0, 5.0, image2.size.width, image2.size.height);

    UIView *v2=[[UIView alloc] initWithFrame:CGRectMake(281.0, 5.0, image2.size.width, image2.size.height) ];

    [v2 addSubview:button2];
        UIBarButtonItem *refresh = [[UIBarButtonItem alloc] initWithCustomView:v2];    self.navigation.rightBarButtonItem = refresh;
    NSLog(@"THE ACTION HAS BEEN RECIEVED!"); }

In my ViewDidLoad Method, I have this:

[self barButton2];
[self barButton];

The action does go through and I do receive my NSLog method. Does anyone know why this is happening? The Left Bar Button always shows up and if I change the the first barbutton to rightbarbuttonitem and change the barbutton2 to leftbarbutton item, and then change the CGRect coords, it works, and that’s what I’m using right now to get it to work, but why is this happening? Thanks in advance.

  • 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-07T06:34:55+00:00Added an answer on June 7, 2026 at 6:34 am

    You don’t see the right button because you are drawing it outside the screen.

    The button2 X coordinate is set to 281.0 and its parent view X coordinate is also set at 281.0. As a result your button is in x = 562, meaning it is outside the screen.

    Set your button2 X coordinate to 0 and see if that helps:

    button2.frame= CGRectMake(0.0, 5.0, image2.size.width, image2.size.height);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get this to work... what could be the problem? import flickrapi api_key
I'm approaching C programming with threads and I can't get this program to work
Ok, I can't get this code work: I want to concatenate my custom manipulators.
Can I write XSD schema for this? Please note that the category is repeated
I cannot get text-overflow: ellipsis; to work... Maybe someone can give ma some help
I had this almost working several hours ago, but I can't seem to get
For the life of me I cannot figure out why I can’t get this
I have an entity Tag and an entity Note . A note object can
Note: when I say static string here I mean memory that can not be
How can I retrieve the first and last record from a table. Note :

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.