1.放2个label -- 自己试试
2.一个label实现
*/
// 标题
let titleLabel = UILabel(frame: CGRectMake(0,0,200,44))
titleLabel.numberOfLines = 0
// titleLabel.text = "发布微博\n\(CZUserViewModel.shareInstance.model?.screen_name ?? "")"
titleLabel.textAlignment = .Center
let str = "发布微博\n\(CZUserViewModel.shareInstance.model?.screen_name ?? "")"
// NSAttributedString -- 这个是不可变的,我们要修改属性的话,需要用到
//NSMutableAttributedString
let attribute = NSMutableAttributedString(string: str)
// 添加属性
// 修改 发布微博 4个字的属性
attribute.addAttributes([NSFontAttributeName: UIFont.systemFontOfSize(15)], range: NSMakeRange(0, 4))
// 修改 名字 的字属性
attribute.addAttributes([NSFontAttributeName: UIFont.systemFontOfSize(13),NSForegroundColorAttributeName: UIColor.orangeColor()], range: NSMakeRange(4, str.characters.count - 4))
titleLabel.attributedText = attribute
// titleLabel.textColor = UIColor.orangeColor()
navigationItem.titleView = titleLabel

2.一个label实现
*/
// 标题
let titleLabel = UILabel(frame: CGRectMake(0,0,200,44))
titleLabel.numberOfLines = 0
// titleLabel.text = "发布微博\n\(CZUserViewModel.shareInstance.model?.screen_name ?? "")"
titleLabel.textAlignment = .Center
let str = "发布微博\n\(CZUserViewModel.shareInstance.model?.screen_name ?? "")"
// NSAttributedString -- 这个是不可变的,我们要修改属性的话,需要用到
//NSMutableAttributedString
let attribute = NSMutableAttributedString(string: str)
// 添加属性
// 修改 发布微博 4个字的属性
attribute.addAttributes([NSFontAttributeName: UIFont.systemFontOfSize(15)], range: NSMakeRange(0, 4))
// 修改 名字 的字属性
attribute.addAttributes([NSFontAttributeName: UIFont.systemFontOfSize(13),NSForegroundColorAttributeName: UIColor.orangeColor()], range: NSMakeRange(4, str.characters.count - 4))
titleLabel.attributedText = attribute
// titleLabel.textColor = UIColor.orangeColor()
navigationItem.titleView = titleLabel