Bug 49284 - UITextView TextColor change has no effect on iPhone 4/5
Summary: UITextView TextColor change has no effect on iPhone 4/5
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 10.2 (iOS 10.1)
Hardware: Macintosh Mac OS
: --- major
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-12-08 08:49 UTC by eeli.reilin
Modified: 2016-12-08 17:32 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED ANSWERED

Description eeli.reilin 2016-12-08 08:49:13 UTC
# Steps to reproduce

Set the text color property of a UITextView to any other color than the default black, either via a storyboard or programmatically:

    NotesText.TextColor = UIColor.White;
    NotesText.Text = "Foo";

# Expected behavior

Text color should be white.

# Actual behavior

Text color remains unchanged, or so it seems. If you switch the statements by settings the text first, and color second, it somehow works!

    NotesText.Text = notes;
    NotesText.TextColor = UIColor.White;

I think that when loading the view from a storyboard, text color is always set first, so the bug manifests.

# Supplemental info (logs, images, videos)

# Test environment (full version information)

Tested on iPhone 4s, iOS 9.3 (13E233), I've had reports of this happening on iPhone 5 as well.
Comment 1 Alex Soto [MSFT] 2016-12-08 17:32:39 UTC
Hello I remember this happening because the selectable property in UITextView has to be set to true before doing changes on the Font/Color and then if you'd like set it back to false after doing these changes. This also was reproducible on an ObjC app.

Also another thing to take into account is that if your text is detected to be a phone number/address/etc. you want to change TintColor instead.

Please give this a try and if the problem persists please reopen the bug report and attach a test case showing the exact steps you took.

Cheers!