Tag: uifont

如何将UILabel的字体名称设置为HelveticaNeue Thin在iOS中?

我正在创buildUILabel,对于标签,我可以设置字体名称为HelveticaNeue Regular,Light,UltraLight等,但我无法将字体名称设置为HelveticaNeue Thin,因此无法按预期工作。 我喜欢, label.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:16]; 另外我在Google上search没有得到任何解决scheme。 如何解决这个问题? 谢谢。

相邻的“f”和“l”字符

出于某种原因,当我显示单词“蝴蝶”(或任何其他与“FL”),“f”和“l”连接在顶部(见下图)。 字体是世纪哥特粗体。 这是我用来设置UILabel的代码。 从plist中检索标签的string: UILabel *label = [[UILabel alloc] init]; label.text = [self.flashcardDelegate.alphabetArr objectAtIndex:index]; label.textColor = [UIColor colorWithRed:.733 green:0 blue:.03137 alpha:1]; label.backgroundColor = [UIColor clearColor]; label.frame = CGRectMake(ipad ? 210.0f : 65.0f, ipad ? 650.0f : 300.0f, ipad ? 340.0f : 185.0f, ipad ? 250.0f : 135.0f); label.font = [UIFont fontWithName:@"CenturyGothic-Bold" size:ipad ? 200 : […]

如何在WKInterfaceLabel中使用替代字体重量(例如“short”)?

在苹果的Apple Watch Design Resources中 ,有一个名为Alternate Font Weights and Italicizations的文档。 其中显示了默认字体的样例,其中应用了斜体 , 强调和短等不同的属性。 假设我想使用与“Short”示例完全相同的字体。 有什么办法通过故事板为标签select这种字体和风格? 在代码中,我将如何设置一个标签来使用这种字体和样式?

自定义阿拉伯字体在iOS 7中工作,但不在iOS 6或更早版本中

我有一个iPhone应用程序,我正在使用自定义阿拉伯语字体。 所有工作在iOS 7。 当我在iOS 6上运行应用程序时,文本出现在默认的iPhone字体中。 任何想法出了什么问题? iOS 6截图 iOS 7截图 如果你看到不同,英文工作正常。 唯一的问题与阿拉伯文字体。

在旧金山使用fontWithSize API

通过调整SF Display和SF Text之间的dynamic跟踪和dynamic切换,iOS 9中新的旧金山字体将根据其使用的尺寸进行优化。 在WWDC会议中注意到,#804开发者不应该使用fontWithName尝试初始化UIFont来使用fontWithName ,例如: UIFont *originalFont = [UIFont systemFontOfSize:11]; UIFont *newFont = [UIFont fontWithName:originalFont.fontName size:44]; 这是因为在使用fontWithName API时,系统无法为新大小优化字体。 相反,build议从原始字体中获取UIFontDescriptor ,并按照新的大小创build一个新的字体,如下所示: UIFont *originalFont = [UIFont systemFontOfSize:11]; UIFont *newFont = [UIFont fontWithDescriptor:originalFont.fontDescriptor size:44]; 但是,他们没有提到以下是否允许优化: UIFont *originalFont = [UIFont systemFontOfSize:11]; UIFont *newFont = [originalFont fontWithSize:44]; 我的问题是, fontWithSize API的行为是否像fontWithName API或fontWithDescriptor API – 是否导致新的大小的优化字体?

UILabeldynamic字体大小继续打破

我有CollectionViewCell只有UILabel(与单元格相同的边界)。 我正在获取作为CollectionView数据源的fontNames数组: func printFonts() { let fontFamilyNames = UIFont.familyNames() for familyName in fontFamilyNames { let names = UIFont.fontNamesForFamilyName(familyName as! String) fontNames.append(familyName as! String) } } 我试图在UILabel中的一行显示这个字体名称,它在一些情况下,但在一些不工作,我不知道为什么。 这是我如何“调整” cellForItemAtIndexPath的字体: cell.lbl_font.adjustsFontSizeToFitWidth = true cell.lbl_font.numberOfLines = 1 cell.lbl_font.minimumScaleFactor = 0.1 cell.lbl_font.baselineAdjustment = .AlignCenters cell.lbl_font.textAlignment = NSTextAlignment.Center 以及我通过storyBoard修改了这个属性: 结果: 更新: 我如何应用文本到单元格。 其中lbl_font是单元格内部的cellForItemAtIndexPath let cell : textCell = collectionView.dequeueReusableCellWithReuseIdentifier("text_cell", forIndexPath: […]

UIFont自定义字体不显示在设备上

我有自定义字体的问题。 也就是Tw Cen MT.ttf 这是在这里相同的问题: 自定义字体不显示在设备上,但在模拟器上 除了给定的解决scheme不适合我。 我已经完成了你应该做的事情: 向Info.plist添加了字体 在“构build阶段”中添加字体以复制包资源部分。 以编程方式按名称使用字体不是文件名。 它仍然不起作用。 更有趣的是 – 当我列出可用的字体: NSLog(@"%@", [UIFont familyNames]); 它显示我在模拟器上的字体,但不显示在设备上。 我在iOS 6上testing了新的iPad和iPhone 4。 有什么build议?

iOS – 获得一个字母的“真实”高度

我正在尝试在UIView上布局文本。 (黄色区域是具有背景颜色的UILabel的框架)。 当我使用sizeWithFont我得到这个,它有一个非常大的空间上面的信件: 当我使用font.pointSize我得到这个“我”这是很好的, 但是,当我使用它的“P”我得到了确切的高度,但字母是在底部绘制和裁剪。 **我怎样才能得到只在框架中心的字形? ** 谢谢 沙尼

在-systemFontOfSize:和-boldSystemFontOfSize:之间是否有中等重量的字体?

-systemFontOfSize太薄,而boldSystemFontOfSize太厚。 我需要中间的东西。 当我创build一个像这样的UIFont: [UIFont boldSystemFontOfSize:14]; 然后debugging器打印这个字体信息: font-family:“.Helvetica NeueUI”; font-weight:bold; font-style:normal; font-size:14px 有时字体的中等字体重量。 我怎样才能创build一个这种types的字体,但中等重量?

我可以closures当前未使用的UIAppFonts的文件描述符吗?

我们将很多字体与我们的iOS应用捆绑在一起,我们将它们全部放在UIAppFonts以加快载入速度。 (我们在UIWebView使用它们,比使用@font-face加载文件要快得多)。 然而,这导致我偶尔会得到这样的警告: Mar 13 23:07:16 iPad afcd[2582] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile_house_arrest[2584] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile_house_arrest[2586] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile_house_arrest[2587] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile_house_arrest[2588] <Error>: Max open files: 78 这也与打开文件时的I / […]