What's the UITableView index magnifying glass character?

Viewed 21386

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?

11 Answers

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

In Swift you would use UITableView.indexSearch.

@"{search}" FTW.

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

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;
}

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."

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)

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 ⚦

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

Related