UITableView索引放大镜字符是什么?

发布于 2024-07-07 11:44:42 字数 165 浏览 7 评论 0 原文

在 Apple 的 iPhone 应用程序(如通讯录)中,表格视图索引顶部有一个漂亮的放大镜图标。 由于表视图索引 API 是基于字符的,因此我假设这个放大镜是 Unicode 字符。 到目前为止,我已经采取了在那里放置一个问号字符的方法,但这看起来很蹩脚。

谁能告诉我放大镜是什么角色?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

删除会话 2024-07-14 11:44:42

返回 UITableViewIndexSearch 作为部分索引标题(与@“{search}”相同)也有效。

在 Swift 中,您将使用 UITableView.indexSearch

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

In Swift you would use UITableView.indexSearch.

左耳近心 2024-07-14 11:44:42

@“{search}” FTW。

返回该标题,它会神奇地被正确的字形替换。

@"{search}" FTW.

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

等风也等你 2024-07-14 11:44:42

在 tableView:sectionForSectionIndexTitle:AtIndex: 中显式滚动到顶部并返回 NSNotFound:

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

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;
}
甜`诱少女 2024-07-14 11:44:42

放大镜已经有一个现有的 UTF 代码点。 它是 U+1F50D。 然而让 Xcode 识别这个数字有点棘手。 根据 Apple 的字符串编程指南,UTF 位应分为两个 UTF-16 代理项对(0xD83D、0xDD0D)。 请查看此代理对计算器以供参考。

可以通过以下方式获取具有代理对内容的 NSString 实例:

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

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];
秋心╮凉 2024-07-14 11:44:42

您当然可以在表视图索引中放置一个 Unicode 字符(我已经用其他字符完成了此操作),并将标题放置在第一个表部分中,而不是 tableViewHeader。 也就是说,我还没有在任何 unicode 参考文献中找到放大镜。 我发现的结束符是电话录音机符号 - ⌕ (\u2315)。 不幸的是,它指向了错误的方向,“手柄”延伸到了“放大镜”中。

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

不必你懂 2024-07-14 11:44:42

例如,在 IndexTitlesForTableView 部分中添加 NSMutableArray* 标题,除了索引之外,还添加 [titles addObject: UITableViewIndexSearch]

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

伴随着你 2024-07-14 11:44:42

我知道这是一篇旧帖子,但因为它与我正在寻找的内容类似地相关...如果有人正在寻找放大镜的 Unicode 字符,那么这将是由以下表示的 \u128269:

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.

怀里藏娇 2024-07-14 11:44:42

有人声称 Apple 告诉他们 SDK 不支持此功能。

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

夏末染殇 2024-07-14 11:44:42

我可以理解为什么有人可能不想使用该图像,尽管它非常漂亮......角色更容易维护并且可以轻松扩展。

⚦ 是放大镜状字形的另一个 unicode 选项.. 再次它没有面向正确的方向.. 我相信这确实是某种雌雄同体的性别符号。 上面的 unicode 符号的 html 是 ⚦

我真的认为应该将放大镜符号添加到“26:Misc.Symbols”下的unicode字符集中。

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

星星的軌跡 2024-07-14 11:44:42

您可以使用空格作为索引字符,然后覆盖禁用用户交互并包含以下图像的 UIImageView搜索图标
(来源:booleanmagic.com

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文