[英]How to implement Blurred Background Image in Watchkit like TuneIn app
我想在iWatch應用中實現模糊的背景圖像。 監視包。 像TuneIn這樣的許多應用程序都可以實現這一點。 有一些答案可以添加模糊視圖,但watchkit不支持addsubview。
TuneIn應用程序顯示了這種效果: https : //itunes.apple.com/us/app/tunein-radio/id418987775
我想實現這樣的事情。
請幫忙! 提前致謝! 任何建議將不勝感激。
試試下面,
//only apply the blur if the user hasn't disabled transparency effects
if !UIAccessibilityIsReduceTransparencyEnabled() {
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds //view is self.view in a UIViewController
view.addSubview(blurEffectView)
//if you have more UIViews on screen, use insertSubview:belowSubview: to place it underneath the lowest view
//add auto layout constraints so that the blur fills the screen upon rotating device
blurEffectView.setTranslatesAutoresizingMaskIntoConstraints(false)
} else {
view.backgroundColor = UIColor.blackColor()
}
他們通過將手機上的圖像模糊然后再將其發送到手表來實現。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.