Unicode characters can be used to display all sort of symbols. There are scenarios where those symbolic representations prove to be essential for an application. In this article we will take a look at different scenarios where Unicode symbols can benefit the application.

UITableView Checkmark:

The UITableViewCell can display an accessory view as a checkmark but unfortunately, the checkmark is always displayed on the right hand side. A work around would be to create and use images to represent the checked and unchecked state. However, you can also utilize the power of uni code characters to display checkmarks. Check out the screenshot below which shows the Unicode checkmarks displayed in the UITableView.



The UITableView uses a custom UITableViewCell where a UILabel is used as a placeholder for a checkmark. The UILabel is also set as AttributedString, which is used for a different purpose. The UILabel is then assigned a Unicode character which displays the checkmark. The Unicode characters are stored in the const as shown below:



Inside the cellForRowAtIndexPath we assign the Unicode string to the label's text.



Make sure that the UILabel is enabled to receive events. This can be accomplished by setting the userInteractionEnabled property to YES from using the interface builder. Finally, we can attach the UITapGestureRecognizer to the UILabel as shown below:



Now, when the UILabel which represents the checkmark is touched it triggers the checkboxSelected event which is implemented below:



Apart from changing the state of the checkmark we also strike through (Using AttributedString) the description UILabel to make a more realistic effect as shown in the screenshot below:



If in the future you want a different symbol then you can simply change the Unicode and get a new symbol as shown in the code below:





Here is a very good resource while lists tons of unicode characters and their symbols:

Unicode Charts

UITabBar:

UITabBar items consists of a title and an image. The image part is *not* mandatory. You can display an image in the title with the use of Unicode characters. Here is a quick example:





UIBarButtonItem:

You can even change the UIBarButtonItem and decorate it with the Unicode character as shown in the screenshot below:



References:

1) Adding Images to UIActionSheet Button as in UIDocumentInteractionController

Conclusion:

In this article we discussed how Unicode characters can be used in iOS applications. Although Unicode character set is quite limited but it can still provide graphical benefits to the applications.