soffes / SAMTextView

Add a placeholder to UITextView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Placeholder Color is Black When Used in Storyboard

sethfri opened this issue · comments

Since Version 0.2.0 and the introduction of attributedPlaceholder, when the default SAMTextView is placed into a storyboard and something like

textView.placeholder = @"Example";

is done in code, the color of the placeholder text, which used to be light gray by default, is ignored. Whatever color the actual text is set to be in the storyboard is the color set for the placeholder text as well.

I'm doubting this is intentional behavior, but I just wanted to run it by you and make sure.

I think the is probably due to the textView being the first responder prior to you setting the placeholder text. Because of this line here

if ([self isFirstResponder] && self.typingAttributes) {
                [attributes addEntriesFromDictionary:self.typingAttributes];
        }

sets the attributes to the typing attributes of the textView. It's easy enough to remove that if but I'm not quite sure what the intentional behavior is.

@ScottPetit Actually I just realized the [self isFirstResponder] check was added after 0.2.0 and fixes the issue I've described.

@soffes Could you make a tag for Version 0.2.1 so people utilizing CocoaPods can take advantage of this fix?

Thanks Sam!