我尝试了以下代码将自定义字体添加到imglyKit SDK中,但没有添加自定义字体.我还将.ttf文件作为资源放入info.plist文件中.
let sampleImage = image.image let configuration = Configuration() { builder in FontImporter.init().importFonts() builder.configurePhotoEditorViewController({ (editPhotoOption) in editPhotoOption.allowedPhotoEditorActions = [.text] editPhotoOption.actionButtonConfigurationClosure = {cell,_ in cell.captionLabel.text = "Add Text" //cell.backgroundColor = UIColor.red } editPhotoOption.backgroundColor = UIColor.brown editPhotoOption.allowsPreviewImageZoom = false }) builder.configuretoolStackController({ (toolStackOption) in toolStackOption.mainToolbarBackgroundColor = UIColor.red toolStackOption.secondaryToolbarBackgroundColor = UIColor.brown }) builder.configureTextFontToolController({ (textFontToolOption) in var fontArray = [String]() fontArray = ["AlexBrush_Regular.ttf","arabella.ttf"] textFontToolOption.accessibilityElements = fontArray textFontToolOption.actionButtonConfigurationClosure = { cell,_ in cell.backgroundColor = UIColor.red } }) builder.configureTextToolController({ (textToolOption) in textToolOption.textViewConfigurationClosure = { label in label.textAlignment = NSTextAlignment.center } }) } let photoEditViewController = PhotoEditViewController(photo: sampleImage!,configuration: configuration) let toolStackController = ToolStackController(photoEditViewController: photoEditViewController) toolStackController.delegate = self toolStackController.navigationController?.view.backgroundColor = UIColor.red present(toolStackController,animated: true,completion: nil)
我也使用FontImporter类来加载自定义字体,如http://static.photoeditorsdk.com/docs/ios/Classes/FontImporter.html所示
谢谢…
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。