var bgImage = UIImageView()
var backButton = UIButton()
var titleLabel = UILabel()
let screen_h = UIScreen.main.bounds.height
let screen_w = UIScreen.main.bounds.width

override init(frame: CGRect) {
super.init(frame: frame)
initUI()
}


required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func initUI() {
// bgImage.frame=CGRect(x:0,y:0,width:screen_w,height:64)
// bgImage.backgroundColor = UIColor(patternImage: UIImage(named:"navbar_bg")!)
// self.addSubview(bgImage)

//首先创建一个模糊效果
let blurEffect = UIBlurEffect(style: .dark)
//接着创建一个承载模糊效果的视图
let blurView = UIVisualEffectView(effect: blurEffect)
//设置模糊视图的大小(全屏)
blurView.frame.size = CGSize(width: screen_w, height: 64)
//添加模糊视图到页面view上(模糊视图下方都会有模糊效果)
blurView.alpha=0.7
self.addSubview(blurView)

backButton = UIButton(type: .custom)
backButton.frame = CGRect(x:0 , y:20, width:60, height:44)
backButton.backgroundColor = UIColor.clear
backButton.setImage(UIImage(named:"btn_Return"), for: .normal)
self.addSubview(backButton)

titleLabel.frame=CGRect(x:screen_w/2-100,y:20+44/2-8,width:200,height:18)
titleLabel.text="Old glass"
titleLabel.textColor=UIColor.white
titleLabel.textAlignment = .center
titleLabel.font = UIFont(name: "Arial", size: 16.0)
self.addSubview(titleLabel)
}