Reputation: 827
I have a UITextView set by interface builder. Depending on the user's actions, I want to display an emoji inside the textfield. This is how I do it right now (capturing in a NSString):
emojiSelected = [NSString stringWithUTF8String:"\xF0\x9F\x98\x9C"];
And then later on (setting the UITextField):
cell.emoji.font = [UIFont fontWithName:@"AppleColorEmoji" size:40.0];
cell.emoji.text = emojiSelected;
Now this works, except the emoji is tiny - barely visible. I have tried to change the font to make it big, but nothing changes. Note that I have set the font the same way in interface builder. If I copy paste an emoji from the web and copy it in my textfield in IB, I can change the size to whatever I want. Can we do that programmatically?
Upvotes: 2
Views: 945
Reputation: 17902
Use a UILabel instead of a UITextView and it should work!
If you want a UITextView type section instead of a UILabel you can use a UIWebView with custom html loaded that has a <text area>
tag and allow users to type in that. You can retrieve what is typed via javascript injection. (Side note: you can give UIWebView's transparent backgrounds)
Upvotes: 2