What's the UITableView index magnifying glass character?

IphoneCocoa TouchUitableviewIcons

Iphone Problem Overview


In Apple's iPhone apps (like Contacts), they have a nice magnifying glass icon at the top of the table view index. Since the table view index API is character-based, I assume that this magnifying glass is a Unicode character. So far I've resorted to placing a question mark character there, but that looks lame.

Can anyone tell me what character the magnifying glass is?

Iphone Solutions


Solution 1 - Iphone

Returning UITableViewIndexSearch as section index title (same as @"{search}") also works.

In Swift you would use UITableView.indexSearch.

Solution 2 - Iphone

@"{search}" FTW.

Return that title and it's magically replaced by the correct glyph.

Solution 3 - Iphone

In tableView:sectionForSectionIndexTitle:AtIndex: explicitly scroll to the top and return NSNotFound:

- (NSInteger) tableView:(UITableView *)tableView
sectionForSectionIndexTitle:(NSString *)title
                atIndex:(NSInteger)index {
    if (index == 0) {
        [tableView setContentOffset:CGPointZero animated:NO];
        return NSNotFound;
    }
    return index;
}

Solution 4 - Iphone

There already is an existing UTF codepoint for the magnifying glass. It is U+1F50D. However it's slightly tricky getting Xcode to recognize this number. According to Apple's String Programming Guide the UTF bits should be split into two UTF-16 surrogate pairs (0xD83D, 0xDD0D). Check with this surrogate pair calculator for reference.

An NSString instance with the contents of the surrogate pair can be obtained with:

[NSString stringWithFormat:@"%C%C", 0xD83D, 0xDD0D];

Solution 5 - Iphone

Solution 6 - Iphone

You can certainly put a Unicode character in the table view index (I've done this with other characters) and put your header in the first table section in lieu of of the tableViewHeader. That said, I've yet to find the magnifying glass in any of the unicode references. The closes I've found is the Telephone Recorder symbol - āŒ• (\u2315). Unfortunately, it points in the wrong direction and the "handle" extends into the "magnifying glass."

Solution 7 - Iphone

In the sectionIndexTitlesForTableView add a NSMutableArray* titles for example and in addition to your indexes add the [titles addObject: UITableViewIndexSearch]

Solution 8 - Iphone

I know this is an old post but since it's similarly related to what I was looking for... If anyone is looking for the Unicode Character of the magnifying glass, it would be this one \u128269 represented by this: šŸ” that is if your browser is displaying unicode

You can view the full detail of it on this web site: http://www.charbase.com/1f50d-unicode-left-pointing-magnifying-glass

In my case I wanted to do a search input box with the magnifying glass in it, I manage to do it via this piece of code, please note that we need to use a special font that might not work in older browser or OS:

<input type="text" style="font-family: Segoe UI Symbol;" placeholder="&#128269;">

This works on my machine Win7 in both Firefox and Chrome but IE is always an exception with placeholder in this case.

Solution 9 - Iphone

Someone claims that Apple told them this isn't supported in the SDK.

Solution 10 - Iphone

You could use a space as the character for the index and then overlay an UIImageView that has user interaction disabled and contains the following image: Search Icon
(source: booleanmagic.com)

Solution 11 - Iphone

I can understand why someone might not want to use the image, although it is very pretty... characters are so much easier to maintain and can scale with little effort.

āš¦ is another unicode option for a magnifying lens-like glyph.. again it's not facing the correct direction.. I believe it's really some kind of hermaphroditic gender symbol. The html for the unicode symbol above is &#9894;

I really think a magnifying lens symbol should be added to the unicode character set under "26: Misc. Symbols".

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid GrantView Question on Stackoverflow
Solution 1 - Iphoneuser123417View Answer on Stackoverflow
Solution 2 - IphoneIan BairdView Answer on Stackoverflow
Solution 3 - IphoneMarcello Bastea-ForteView Answer on Stackoverflow
Solution 4 - IphoneweibelView Answer on Stackoverflow
Solution 5 - IphonePetr DvorakView Answer on Stackoverflow
Solution 6 - IphoneJablairView Answer on Stackoverflow
Solution 7 - IphoneZsoltView Answer on Stackoverflow
Solution 8 - IphoneghiscodingView Answer on Stackoverflow
Solution 9 - IphonecarsonView Answer on Stackoverflow
Solution 10 - IphonerpetrichView Answer on Stackoverflow
Solution 11 - IphoneJon zView Answer on Stackoverflow