我们在项目中使用自定义字体.它在Xcode 5中运行良好.在Xcode 6中,它以纯文本形式工作,在代码中归因于字符串.但是,在故事板中设置的那些归因字符串在模拟器或设备上运行时都会恢复到Helvetica,尽管它们在故事板中看起来很好.
我不确定这是Xcode 6或iOS 8 SDK的错误,还是在Xcode 6/iOS 8中改变了使用自定义字体的方式?
我正在尝试以编程方式设置字体.我想像我在界面构建器中使用的那样使用System Semibold.一直在字体列表中寻找它.我需要使用吗?
[myButton.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Semibold" size:13.0]]
Run Code Online (Sandbox Code Playgroud)
?
在WWDC 2014视频中解释说,您可以直接在Storyboard中设计自定义字体,但到目前为止我只看到iOS字体列表.有帮助吗?
我是swift的新手,我想在我的SpriteKit项目中添加一个自定义字体,然而,在环顾四周之后,我找不到解决方案.
我得到一个包含字体的文件(请找到附件),该字体应该根据代码号显示图标。但是我没有成功显示任何带有此字体的图标。这是我的代码:
iconTest = UILabel();
iconTest.frame = CGRectMake(0, 0, 100, 100);
onTest.center = self.view.center;
iconTest.font = UIFont(name: "icomoon", size:16.0);
iconTest.text = "e906";
Run Code Online (Sandbox Code Playgroud)
用字体显示图标的正确方法是什么!
我正在尝试自定义UISegmented控件的字体,我使用以下代码,如下所示:
let selectedfont = UIFont(name:"Roboto-Bold", size:22)
let unselectedfont = UIFont(name:"Roboto-Regular", size:22)
let normalTextAttributes: [String: Any] = [
NSForegroundColorAttributeName: UIColor(red: 0.60, green: 0.60, blue: 0.60, alpha: 1.0),
NSFontAttributeName: unselectedfont as Any
]
let selectedTextAttributes: [String: Any] = [
NSForegroundColorAttributeName: UIColor.black,
NSFontAttributeName: selectedfont as Any
]
self.setTitleTextAttributes(normalTextAttributes, for: UIControlState())
self.setTitleTextAttributes(selectedTextAttributes, for: .highlighted)
self.setTitleTextAttributes(selectedTextAttributes, for: .selected)
Run Code Online (Sandbox Code Playgroud)
但应用程序崩溃显示: 由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [NSNull pointSize]:无法识别的选择器
这是什么问题?任何帮助都会得到满足.