Bug 22625 - UITableView.Appearance is "missing" some properties such as TextColor
Summary: UITableView.Appearance is "missing" some properties such as TextColor
Status: NEW
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.4.x
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-09-04 00:36 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-09-04 00:36 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 22625 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-09-04 00:36:22 UTC
`UITextView.Appearance` is "missing" some properties such as `TextColor`.

This is essentially the same issue as https://bugzilla.xamarin.com/show_bug.cgi?id=21221, but for `UITextView` instead of `UIScrollView`.

As discussed on bug 21221 (and bug 8342), the UIKit headers distributed by Apple [1] do not strictly adhere to the rule that properties that participate in the appearance proxy API should be tagged with the UI_APPEARANCE_SELECTOR [2].

> [1] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/

> [2] https://developer.apple.com/library/ios/recipes/UIAppearanceContainer_Protocol/Reference/Reference.html#//apple_ref/c/macro/UI_APPEARANCE_SELECTOR

The fact that none of the `UITextView` properties are tagged conflicts with the "Appearance of Text Views" section from the iOS Developer Library [3]. That article lists the following properties:
- font
- textColor
- textAlignment
- typingAttributes
- attributedText

And then says: "To customize the appearance of all text views in your app, use the appearance proxy (for example, [UITextView appearance])". 

> [3] https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/UIKitUICatalog/UITextView.html#//apple_ref/doc/uid/TP40012857-UITextView-SW3

## Workaround

You can treat the appearance proxy as a full `UITextView` instead of a `UITextView.UITextViewAppearance` (see [4]). That way you'll be able to attempt to set any property that is part of `UITextView`. Just remember that not all of the properties from `UITextView` will necessarily be compatible with the appearance proxy!

> [4] http://stackoverflow.com/a/14531680/220643

Here's an example that sets a few properties on the appearance proxy. All the properties in this example seem to work on iOS 7.

> var appearance = new UITextView (UITextView.Appearance.Handle);
> appearance.Text = "Override text in all text views";
> appearance.TextColor = UIColor.Blue;
> appearance.Font = UIFont.BoldSystemFontOfSize(16);
> appearance.TextAlignment = UITextAlignment.Justified;
> appearance.TextContainerInset = new UIEdgeInsets(10, 10, 10, 10);