0

I'm trying to place two Unicode symbols inside an UIAlectAction. I should have two circles, one empty and the other one filled. My current code is:

NSString *unicodeStar = [NSString stringWithFormat:@"%C %C", 0x25CB,0x25CF];


    UIAlertAction* star = [UIAlertAction
                                 actionWithTitle:unicodeStar
                                 style:UIAlertActionStyleDefault
                                 handler:^(UIAlertAction * action)
                                 {

                                 [view dismissViewControllerAnimated:YES completion:nil];

                                 }];
    [view addAction:star];

According to the Unicode Character Table this two symbol should have the same dimension but the actual result is:

enter image description here

All the other circles have the same dimension. What am I missing?

Claus
  • 5,662
  • 10
  • 77
  • 118

1 Answers1

2

It's the font being used by the alert view. If you use the character viewer in OS X, when you look at the "White Circle" character, it shows the same character in all of the fonts on your machine and you can see it is lots of different sizes depending on the font.

Since there is no way to change the font used by the alert view, your best option is to choose two different characters. There are several unfilled circle characters and several filled in circle characters. Try various combinations until you find two that appear in the same size in the standard system font used by the alert view.

Update:

Here's two that come out the same size:

NSString *unicodeStar = @"⚪︎ ⚫︎";

The open circle is the "MEDIUM WHITE CIRCLE" (U+26AA U+FE0E) and the filled circled is the "MEDIUM BLACK CIRCLE" (U+26AB U+FE0E).

rmaddy
  • 314,917
  • 42
  • 532
  • 579