【发布时间】:2019-04-07 06:58:04
【问题描述】:
我正在尝试使用 NSMutableAttributedString 制作文本标题,但是在属性字典中,我相信我得到了正确的代码,但是当我运行代码时,总是有灰色背景,我做错了什么?或者我可能会错过什么?
let titleTextView: UITextView = {
let textView = UITextView()
let attributedText = NSMutableAttributedString(string: "Wake Up Happy", attributes: [NSAttributedString.Key.font: UIFont.init(name: "Marker Felt", size: 40)!, NSAttributedString.Key.backgroundColor: UIColor.clear])
textView.attributedText = attributedText
textView.textAlignment = .center
textView.isEditable = false
textView.isScrollEnabled = false
textView.translatesAutoresizingMaskIntoConstraints = false
return textView
}()
我希望得到清晰的背景而不是灰色的背景。
【问题讨论】:
-
可能这个
gray背景来自UITextView。
标签: ios swift xcode text fonts