iphone - NSString 中的撇号和反撇号

标签 iphone objective-c ios nsstring

如果我在 Photoshop 的 Helvetica Bold 中键入 ''(即直接在 enter/return 键左侧的键 2x),我得到以下内容:

enter image description here

但是,如果我通过 NSString 在 iOS 中绘制相同的字符串,我会得到:

enter image description here

有没有办法用 NSString 获得花哨的撇号而不是垂直线的撇号?

最佳答案

在较新的 XCode 中,您可以直接在 @"" 定义中包含字形。

所以:NSString *test = @"\u2018Hello\u2019";

在旧版本中(以及更复杂的情况下),您可能会发现使用这种格式很有帮助:

NSString *test = [NSString stringWithFormat:@"%CHello%C", 0x2018, 0x2019];

查看维基百科以获取对各种引用字形和代码点的引用: http://en.wikipedia.org/wiki/Quotation_mark_glyphs

关于iphone - NSString 中的撇号和反撇号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11894886/

相关文章:

iphone - iPhone 上网站的初始可视区域是多少?

ios - UISearchBar 和/或 UISearchDisplayController 颜色

iphone - 禁用 TabBar 的后退功能

android - Google翻译手机应用程序是否使用Tesseract在本地进行OCR?

html - 固定位置页脚在 iPhone X 中滚动

iphone - 选择图像以在我的整个应用程序中用作UIViewController背景

ios - 获取 NSString 中所有大写字母的 NSRange 对象数组的最快方法?

ios - 动画动图

ios - DefinesPresentationContext/UIModalPresentationCurrentContext 的问题 - 当前上下文 View Controller 丢失

ios - Objective-C 对象能否在其方法中删除自身(启用 ARC)?