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 assu
In the sectionIndexTitlesForTableView add a NSMutableArray* titles for example and in addition to your indexes add the [titles addObject: UITableViewIndexSearch]
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:
(source: booleanmagic.com)
Returning UITableViewIndexSearch as section index title (same as @"{search}") also works.
In Swift you would use UITableView.indexSearch
.
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];
@"{search}"
FTW.
Return that title and it's magically replaced by the correct glyph.
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="🔍">
This works on my machine Win7 in both Firefox and Chrome but IE is always an exception with placeholder in this case.