how to set custom navigator title

来源:互联网 发布:直销软件结算系统公司 编辑:程序博客网 时间:2024/05/21 09:56

Method is that navigationItem.titleView uses UIView,
and this UIView add custom title.

example:

var containerView = UIView()        containerView.frame = CGRectMake(30, 30, 400, 50)        var titleview = UIImageView(image: UIImage(named: "titleImage"))        //titleview.backgroundColor = UIColor.redColor()        titleview.alpha = 0.6        titleview.frame = CGRectMake(10, -10, 300, 30)        //titleview.contentMode = .ScaleAspectFit        containerView.addSubview(titleview)        navigationItem.titleView = containerView
0 0
原创粉丝点击