UITextField Appearance RRS feed

  • Question

  • User87 posted

    I'm under the impression that you can set the font for all UITextFields using the appearance protocol. When I access UITextField.Appearance, all I get access to is BackgroundColor. Am I mistaken, or is there a binding issue with the appearance protocol in MT?

    Cheers, Greg

    Sunday, October 21, 2012 11:41 AM

All replies

  • User59 posted

    If you look here:


    then run this:

    cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/



    It shows your everything. UITextField has nothing....

    Monday, October 22, 2012 1:11 PM
  • User87 posted

    Oh. Thanks @nicwise. I was sure I'd see some code setting font information.

    Cheers, Greg

    Monday, October 22, 2012 11:09 PM
  • User64 posted

    Yeah, this is why I generally subclass UITextField to "fake" UIAppearance for it.

    Doesn't work in all cases though, you'll bump into UISearchBar and other things that use UITextField internally.

    Tuesday, October 23, 2012 3:15 AM
  • User43350 posted

    @nicwise UILabelAppearance has the Font property though UILabel.h has no UIAPPEARANCESELECTOR, so it looks like the rule is not always right.

    I also tried: var appearance = UITextField.AppearanceWhenContainedIn(typeof(UISearchBar)); Messaging.void_objc_msgSendSuper_IntPtr (appearance.SuperHandle, Selector.GetHandle ("setFont:"), font.Handle); and it looks like it works good.

    Friday, July 18, 2014 5:51 PM