Bug 16978 - UITextAttributes and UIStringAttributes appear to be duped classes
Summary: UITextAttributes and UIStringAttributes appear to be duped classes
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.4.x
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2013-12-28 13:10 UTC by Todd Berman
Modified: 2015-04-21 06:55 UTC (History)
5 users (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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Todd Berman 2013-12-28 13:10:05 UTC
From what I can tell reading docs and looking at examples, they are both attempting to wrap a dictionary full of various options that control text rendering.

The issue is that UIStringAttributes appears to be up to date, and UITextAttributes appears to be old and broken. Everywhere that takes a UITextAttributes class should be updated to also accept a UIStringAttributes class.
Comment 1 Atin 2014-01-02 05:52:03 UTC
Could you please provide us the docs and examples that you are referring to? So that we can have look at this.
Comment 2 Todd Berman 2014-01-02 11:21:35 UTC
Do you guys need docs? Its pretty clear that the issue is you are wrapping an NSDictionary improperly. Happy to provide docs if necessary, however it doesn't seem like it would be, and I'd prefer not to waste my time.

Let me know.
Comment 3 PJ 2014-01-02 11:26:38 UTC
Hi Todd, I've assigned this to somebody who will confirm the bug, no need to update. Thanks!
Comment 4 Oleg Demchenko 2014-01-03 13:37:15 UTC
Hi Todd, UITextAttributes works fine for me. Here you can find sample code of how it can be used:

Please let me know in what case UITextAttributes works improperly for you. Thanks.
Comment 5 Todd Berman 2014-01-03 13:39:31 UTC
Yes it works fine, the issue is it doesn't have all the properties that you should be able to use, where as UIStringAttributes does. Both of these classes represent the same UIKit objects (NSDictionaries that have specific keys that are used to control text rendering properties). However, UITextAttributes doesn't appear to be complete, and it looks like an older hand-created wrapper, where as UIStringAttributes appears to be the proper complete wrapper.

Does that make sense?
Comment 6 Oleg Demchenko 2014-01-03 14:11:39 UTC
Set "CONFIRMED" to this bug.  Think we can do something about it. Thanks again!
Comment 7 Rolf Bjarne Kvinge [MSFT] 2014-01-06 07:54:23 UTC
Some history can be found here: http://tirania.org/monomac/archive/2012/Aug-24.html
Comment 8 Rolf Bjarne Kvinge [MSFT] 2015-04-21 06:55:35 UTC
UITextAttributes is exposed in 4 classes: UIBarItem, UINavigationBar, UISearchBar and UISegmentedControl, and all 4 cases Apple's documentation says exactly the same about the corresponding properties: "The attributes dictionary can specify the font, text color, text shadow color, and text shadow offset for the title in the text attributes dictionary"

And that's exactly what UITextAttributes does, it allows you to specify font, text color, text shadow color and text shadow offset (and nothing else). Exactly which properties should be allowed in addition to those?

We could allow UIStringAttributes in addition to UITextAttributes in all API that already takes UITextAttributes, but I'm not sure it would be clearer, since you'd be able to set properties that won't do anything (at least according to Apple's documentation).