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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:42:20+00:00 2026-05-27T20:42:20+00:00

UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@cancel.png]]]; button.target = picker.navigationBar.topItem.leftBarButtonItem ; button.action

  • 0
        UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cancel.png"]]];
button.target = picker.navigationBar.topItem.leftBarButtonItem ;
button.action = picker.navigationBar.topItem.leftBarButtonItem.action;
picker.navigationBar.topItem.leftBarButtonItem=button;

Hi folks, I’m trying to change the style of the buttons of the mail composer. The above code does change the look of the button, however the action seems to be lost. Any ideas how I can overcome this? 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-27T20:42:21+00:00Added an answer on May 27, 2026 at 8:42 pm

    The fix for this is fairly simple. You add a method to this button and then define what should happen in the method. So first, put this line after you declare your button.

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

    That will add a method to be called when the button is clicked/touched. Then, later in the code, you create the actual method that the button will be calling.

    -(void)aButtonClicked:(id)sendr{
    //Do stuff here
    
    }
    

    Hope this helped 🙂

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

Sidebar

Related Questions

I add custom button to navigation controller UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@back.png]
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:@rGoBack style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = backButton; [backButton release];
Here's my code: UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(rightButtonPressed)]; [self.navigationItem setLeftBarButtonItem:leftButton]; [leftButton
I have created button for home like this: UIBarButtonItem * addButton=[[UIBarButtonItem alloc] initWithTitle:@Home style:UIBarButtonItemStyleBordered
how can hide particular button which is created from UIBarButtonItem in iphone ?
is it possible to balance the position of button(example toolbar in Safari)? UIBarButtonItem *infoButton
I've got a custom view inside of a UIBarButtonItem , set by calling -initWithCustomView
I created a custom button and applied it to the UIbarbuttonitem. There is no
Following is the code for UISegmentedControl UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects: [UIImage
I create a few UIBarButtonItem with interface builder and try to customize the button

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.