[Objective-C] Add image on UIAlertView/UIActionSheet buttons

A beautiful tricks to add simple images on every place you want using UNICODE characters!

Have you never tried this code?

[code lang=”java” autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]UIAlertView *Alert =
[[UIAlertView alloc] initWithTitle:@"test alert" message:@""
delegate:nil
cancelButtonTitle:@"\u26A1 \u26A2 \u26A3 no"
otherButtonTitles:@"\u26A0 Yes", nil];
[Alert show];
[Alert release];

/*
@"\U0001F6A9 \U0001F4CC \u26F3 \u2690 \u2691 \u274F \u25A4 Test"
@"\U0001F4D6 \U0001F30E \U0001F30F \u25A6 \U0001F3C1 \U0001F332 \U0001F333 \U0001F334 Test"
*/[/code]

As you can read on stackoverflow.com you can use unicode in every UI Component. It’s simple text that was rendered as image.

You can add images on buttons in UIActionSheet, you can add images on UITableViewCell default or UIAlertView. Probably where you want… (TBV)

List of some unicode “images”:

– Miscellaneous Symbols And Pictographs
– Miscellaneous Symbols
– Transport and Map Symbols
– Dingbats

UIAlertView

alert view with image

UITableViewCell

UIActionSheet

Rif: stackoverflow.com
Rif: arashnorouzi
Rif: albertopasca.it

Alberto Pasca
Latest posts by Alberto Pasca (see all)