如何在 Swift 的底部面板中创建不透明背景?

How to create opaque background like in the bottom panel in Swift?

我想用 iOS7-8 底部面板中的背景颜色创建标签,如下所示:

或者创建一个视图并在其中放置标签。我怎样才能达到这个结果?

您可以使用 bluereffect

例如

    let blurEffect =  UIBlurEffect(style: UIBlurEffectStyle.Light)
    let bluredEffectView = UIVisualEffectView(effect: blurEffect)
    bluredEffectView.frame = CGRectMake(100, 100, 200, 200)
    self.imageview.addSubview(bluredEffectView)

屏幕截图