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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:01:50+00:00 2026-05-26T17:01:50+00:00

I try to create a UIBarButtonItem with a custom view for a Toolbar. The

  • 0

I try to create a UIBarButtonItem with a custom view for a Toolbar. The view itself is displayed well, but when i click the BarButton, no action occurs. It looks like the touch event is not forwarded from the view to the UIBarButtonItem instance. I have checked the responder chain and i think it looks good. I have also searched the internet and checked the Apple documentation, but can’t find any hint for my problem.

Here is my code:

   g__objWeatherButton = new UIBarButtonItem[1];

   UIView l__objCustomView = g__objWeatherDisplay.InfoBarButton; // Returns a reference to my custom view

   UIBarButtonItem l__objButton = new UIBarButtonItem(l__objCustomView);

   l__objButton.Clicked += delegate {this.WeatherButtonEvent();}; // my action handler
   l__objButton.Width = 200;
   l__objButton.Enabled = true;

   g__objWeatherButton[0] = l__objButton;

   this.Items = g__objWeatherButton; // "this" is my UIToolbar object

Can someone give me a hint where the problem is? Or a working code sample (in c# please – have found some examples in Objective-C, but apparently overlooked the crucial trick 😉

  • 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-26T17:01:51+00:00Added an answer on May 26, 2026 at 5:01 pm

    No special trick. When you want to add a custom view to a toolbar or navigation bar, you should subscribe (and respond) to that view’s events. So instead of using a UIView to hold your image, create a UIButton with UIButtonType.Custom and subscribe to that button’s TouchUpInside event.

    You then initialize it like you do with the UIView:

    UIButton l__objCustomUIButton = UIButton.FromType(UIButtonType.Custom);
    //l__objCustomUIButton.SetImage(UIImage.FromFile("your button image"), UIControlState.Normal);
    l__objCustomUIButton.TouchUpInside += delegate { this.WeatherButtonEvent(); };
    UIBarButtonItem l__objButton = new UIBarButtonItem(l__objCustomUIButton);
    

    Just make sure you declare the button in the class scope.

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

Sidebar

Related Questions

I am following this tutorial . All is going well until I try create
I try create custom format for maven assembly plugin. I use following instruction how
I create a few UIBarButtonItem with interface builder and try to customize the button
I try create delegate type using an Expression class, but when I try create
When I try to use UIBarButtonItem's initWithImage to initialize a navigation bar custom image,
I try to create a view without using xib file. Unfortunately, I have problems
I try create method for get the connection string value but without value for
I try to create a new file inside a JSP and try to save
I try to create a thread in QT, can declare, create and start it,
I try to create a very simple app using windows API. I've done some

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.