I have an app that retrieves a user's stream and puts it into a UITableView. However, some include emojis (those little smile faces in iOS), and they just return as boxes in my UILabel.
I've done some research, and I still can't figure it out. Does the text type need to be changed?
Thanks!
Please explain your problem better,from the piece that i understood,notice that emojis have native support in iPhone,so any app can display an emoji in a text box,i recommend you to check the methods you're using to add text to the uitableview and the text encoding from the string which is being displayed,also you could check this link
use NSString drawinrect to display emoji instead of drawGlyphsForGlyphRange.
Related
We're currently developing a game in Unity (2019.4.28f1). This game is played internationally. We'd like to add support for languages other than common Latin written languages. Currently, we're trying to implement support for Burmese, but aren't making much progress.
Finding fonts to display Burmese isn't a big issue. As you can see in the image below, we manage to display all characters that are supposed to be displayed.
However, the big problem here is that the displayed order of symbols isn't the same as what it's supposed to be (see image below for the desired result).
We've tried several fonts that use either Unicode or Zwagyi encoding, but none of them seem to display characters in the correct order. Currently, we're using a padauk font from here, which is supposedly Unicode encoded. Then, within Unity, we applied to following settings to that font:
So, if one of you knows more about this and can share some information with me, that would be much appreciated!
Thanks.
We've already found a solution for this! Before setting the text of the text component convert the Unicode codes to Zwagyi and it'll display the text in the correct order!
All the credits go to this guy who put in the effort to make a tool for these use cases!
Of course, you still need a (Unicode) font that supports these (Burmese) symbols.
Example:
Text textComponent = GetComponent<Text>();
textComponent.text = mmfont.Net.Converter.Uni2ZG(yourUnicodeText);
Is there a way to directly use HTML tags in iPhone SDK? I was wondering how could I display the following text using HTML in a UILabel :
My name is Nitish and I am 24 years old.
It does not seem to be allowed. Look at following post as well:
iPhone - UILabel containing text with multiple fonts at the same time
Look at this alternative as well:
iPhone - UILabel containing text with multiple fonts at the same time (another asnwer)
You can't use UILabel to display richtext, you will have to move to CoreText.
https://github.com/Cocoanetics/NSAttributedString-Additions-for-HTML will allow you to create NASttributeString from HTML source.
This library might help.
https://github.com/elijahdou/RTLabel
Simple rich text display for iOS using html-like markups
Why does my app draw 'á' as 'á' in a UILabel.
I parse the text off a webpage and then draw the text into a label.
Is there something I am missing?
Many Thanks
-Code
This is because the data in the web page is HTML entity encoded so that á is expressed asá. However, as the UILabel doesn't parse/display HTML, it simply displays the content as-is.
As such, you'd need to entity decode the data (to convert á back to á) prior to displaying it. The existing HTML character decoding in Objective-C / Cocoa Touch question/answers (and other questions it links to) should be of some assistance.
How would I go about italicizing a single word in an NSString which will be displayed in a UILabel? Specifically, I don't want all text to be italicized, just one word.
Thanks!
(Edited) I meant UILabel, not UITextField.
I don't think that what you are asking to do is possible (I'd be happy to be proven wrong). However, this library (https://github.com/facebook/three20/) is a popular way to achieve the same result in a UILabel (not text field) . The library works fairly well, but does have a lot of limitations, especially on edge conditions, and of course, it comes with associated overhead.
I'd encourage you to think about other ways of achieving the same user outcome. Can Placeholder text help? How about hints next to your text field?
Good luck.
A native UILabel does not support NSAttributedString which is what is normally used to display strings with formatting. You could try an output the text your self using Core Text but I would suggest checking out FontLabel or the three-20 project mentioned by #JJ Rohrer
Use NSAttributedString... Find controllers to draw NSAttributedString,since UILabel wont support NSAttributedString
Controller for NSAttributedString
I have a text which looks like the following,
the url of the page is http://www.myurl.com, and the phone # is (999)999-9999, blah blah blah...
And I want to show it in a way such that the URL and the phone # are both in different color and bolded. Can I do it using just one UILabel control, or I need to parse them out and put them onto separate UILabel controls. (Note that the text itself could span multiple lines.) How can I do it?
Sorry I forgot to mention that this is for iPhone (CoCoa Touch), where the NSAttributedString is not available.
You might want to check out TTTAttributedLabel. It supports automatic data detection for things like Phone Numbers and URLs, as well as mixed styles with NSAttributedStrings.
You could use an NSAttributeString to decorate your string. There is a good explanation of how to use them here Change the background color of a substring of a drawn NSString?
You could try using a UIWebView, which detects both URLs and phone numbers.