TextView Attributes 設定 字型 樣式
var noteContent = ""
noteContent += "條碼使用時機\n"
noteContent += "1、結帳時出示「手機條碼」累計消費\n"
noteContent += "2、出示「消費折抵/贈獎兌換條碼」使用電子贈品禮券或兌換卡友禮\n\n"
noteContent += "加入會員好處\n"
noteContent += "1、享有停車優惠\n"
noteContent += "2、省下周慶時排隊換禮券的時間\n"
noteContent += "3、卡友周慶可獨享購物禮遇\n"
let optimumTextViewFontSize: CGFloat = 14.0
let myAttribute = [
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSFontAttributeName: UIFont.systemFontOfSize(optimumTextViewFontSize)
]
let myString = NSMutableAttributedString(string: noteContent, attributes: myAttribute )
let myAttribute2 = [
NSForegroundColorAttributeName: UIColor(hexString: "#E7B3B0")!,
NSFontAttributeName: UIFont.boldSystemFontOfSize(optimumTextViewFontSize + 8),
NSUnderlineStyleAttributeName: 1
]
let myString2 = NSMutableAttributedString(string: "現在立即加入,還可獲得100點\n", attributes: myAttribute2 )
myString.appendAttributedString(myString2)
self.noteTextView.attributedText = myString
留言
張貼留言