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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:31:29+00:00 2026-06-17T22:31:29+00:00

The various UIAppearance proxy instances do not respond to selectors (as they are a

  • 0

The various UIAppearance proxy instances do not respond to selectors (as they are a proxy of their relevant types, not an actual instance of it), as discussed in this question and answer.

This makes it impossible to test for new iOS 6 features of the Appearance API. e.g. this appearance change will never execute as the code within the if check always returns false, even on iOS 6, because the instance it is checking is not a real instance but an appearance proxy.

if ( UINavigationBar.Appearance.RespondsToSelector( new Selector("setShadowImage:")))
    UINavigationBar.Appearance.ShadowImage = new UIImage();

The answer linked says to use the instancesRespondToSelector method. However I can’t find it anywhere in the MT APIs. Am I just blind, or is there a different way to achieve this in MT?

  • 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-17T22:31:31+00:00Added an answer on June 17, 2026 at 10:31 pm

    There are few differences between both respondsToSelector: and instancesRespondToSelector:, here’s a good description, except that the later is a static method.

    The answer, from your link, uses instancesRespondToSelector: on the real type, not its Appearance proxy. You can get the same result using RespondsToSelector that is already available in MonoTouch.

    if (new UINavigationBar ().RespondsToSelector( new Selector("setShadowImage:")))
        UINavigationBar.Appearance.ShadowImage = new UIImage();
    

    IOW it assume that if setShadowImage: is available then you can access it’s proxy. That’s not true for features that existed before UIAppearance was available (code might work but the result won’t match your expectations).

    is there a different way to achieve this in MT?

    In many cases you can enable/disable several features by doing a single version check like this:

    if (UIDevice.CurrentDevice.CheckSystemVersion (6,0)) {
        // enable iOS6 new features
    } else {
        // fallback to iOS 5.x supported features
    }
    

    Right now instancesRespondToSelector: is not part of the public API that MonoTouch provide (it would need to be bound in every type, at least in done using generated bindings). However it’s not hard to implement if you want it. You can use this code:

    IntPtr responds_handle = Selector.GetHandle ("instancesRespondToSelector:");
    IntPtr appearance_handle = new UINavigationBar ().ClassHandle; // *not* Handle
    IntPtr setShadowImage_handle = Selector.GetHandle ("setShadowImage:");
    bool result = Messaging.bool_objc_msgSend_IntPtr (appearance_handle, responds_handle, setShadowImage_handle);
    

    And you can turn it into a method if you need it in several places. Keep in mind that it will return the same answer as RespondsToSelector (for your specific question).

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

Sidebar

Related Questions

Various devices use various backgrounds for their options menu. The problem this causes me
For various reasons, I need to runOnUiThread() the actual instantiation & initialization of WebView
On various places they said that you should use @ManagedProperty to get a request
Various connections - e.g. those created with twisted.web.client.getPage() seem to leak - they hang
For various reasons (questioning the reasons is not helpful to me), I'd like to
Various software installations on my laptop each require their own particular version of Python.
Various incarnations of this question have been asked here before, but I thought I'd
On various pages my website uses characters not found in the standard English language
For various reasons (and I assure you they are valid, so no use Cocoa
Tried various different options for this and just running into a road block. I

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.