在创建视图后,是否可以随时更改模糊效果样式?
例如,我在Storyboard模糊视图中创建,但我需要以编程方式将.Light的效果样式更改为.Dark.
我不能只重新创建视图,因为我在该视图中有信息和动态约束(约束在某些情况下随动画而变化).
我想制作一个圆形的UIButton但是具有光线模糊效果和活力,因为它的背景
到目前为止,我已经有了一个圆形的UIButton,但我在网上找到的代码(我是iOS新手,我不是很了解模糊等是如何工作的)添加模糊只是将它作为整个按钮的框架,基本上使按钮再次显示为方形.
我也尝试添加一个视图,然后是UIButton,然后是模糊效果,并将cornerRadius代码应用于该视图,但它也无效.
这是我尝试过的:
shortcutButton.layer.cornerRadius = 0.5 * shortcutButton.bounds.size.width // add the round corners in proportion to the button size
let blur = UIVisualEffectView(effect: UIBlurEffect(style:
UIBlurEffectStyle.Light))
blur.frame = shortcutButton.bounds
blur.userInteractionEnabled = false //This allows touches to forward to the button.
shortcutButton.insertSubview(blur, atIndex: 0)
Run Code Online (Sandbox Code Playgroud) 我使用Swift 2,Xcode 7和Eureka!1.2
我想在我的TableView的单元格中应用模糊效果.我创建了包含效果的视图.但是如何恢复桌子的所有细胞?
我的效果观点:
let blur = UIBlurEffect(style: UIBlurEffectStyle.Light)
let blurView = UIVisualEffectView(effect: blur)
Run Code Online (Sandbox Code Playgroud)
当我更改单元格的样式时,这仅适用于此类型的第一个单元格...
EmailRow.defaultCellUpdate = { cell, row in
cell.backgroundColor = UIColor.clearColor()
cell.backgroundView = blurView
}
Run Code Online (Sandbox Code Playgroud) 背景透明度与BLUR
是否可以在不使用背景图像的情况下模糊视图?我想在模态中的背景模糊视图上显示父内容.
类似的这种:

尝试使用react-native-blur:
它实际上模糊了背景图像.我想模糊并显示模态背后的内容.
尝试与react-native-overlay:但没有变化.
我想在询问触摸ID时模糊背景,并且一旦授权成功,就需要可见的视图控制器,但这并没有发生。即使授权成功,视图控制器仍然是模糊的。解决这个?
import UIKit
import LocalAuthentication
class TabBarViewController: UITabBarController {
@IBOutlet weak var noteTabBar: UITabBar!
override func viewDidLoad() {
super.viewDidLoad()
self.authenticateUser()
self.tabBar.hidden = false
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
let userDefaults = NSUserDefaults.standardUserDefaults()
userDefaults.setObject(false, forKey: "sendModeToggle")
userDefaults.setObject("Avenir-Medium", forKey: "font")
userDefaults.setObject(13, forKey:"fontSize")
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation …Run Code Online (Sandbox Code Playgroud) 我正在创建一个模糊视图的叠加层,中间有一个清晰的矩形切口。到目前为止,我的代码实现了相反的效果,即在中间带有模糊切口的 clearView。
我已经从以下帖子中调整了我的步骤,如果有人能指出我正确的方向,我将不胜感激。
let blurView = UIVisualEffectView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height))
blurView.effect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let scanLayer = CAShapeLayer()
scanLayer.path = CGPath(rect: scanRect, transform: nil)
view.addSubview(blurView)
blurView.layer.addSublayer(scanLayer)
blurView.layer.mask = scanLayer
Run Code Online (Sandbox Code Playgroud) 我有一个工作的ViewController与工作UIBlurEffect.这是我的代码:
@IBOutlet weak var nameLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
let blurEffect = UIBlurEffect(style: .Light)
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = self.view.frame
blurView.setTranslatesAutoresizingMaskIntoConstraints(false)
self.view.insertSubview(blurView, atIndex: 0)
}
Run Code Online (Sandbox Code Playgroud)
现在我想在nameLabel中添加一个UIVibranyEffect.如何以编程方式将UIVibrancyEffect添加到现有的UILabel?
如何使导航栏和状态栏模糊(UIBlurEffect)?当我点击图像向下滚动(滚动视图)到其他图片时,这张图片(在这种情况下是白色机器)在导航栏下丢失了,这个图形必须在具有效果UIBlurEffect的导航栏.
我试过了,但没有奏效:
func addBlurEffect() {
// Add blur view
let bounds = self.navigationController?.navigationBar.bounds as CGRect!
let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
visualEffectView.frame = bounds!
visualEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.navigationController?.navigationBar.addSubview(visualEffectView)
self.navigationController?.navigationBar.sendSubview(toBack: visualEffectView)
visualEffectView.isUserInteractionEnabled = false }
Run Code Online (Sandbox Code Playgroud)
首先,当滚动图片时,导航栏下方会消失.
其次,状态栏仍然是灰色的.
NavigationBar的UIBlurEffect错误,StatusBar没有UIBlurEffect
为了状态栏不保持灰色,我试着这样做,但无济于事=(
bounds.offsetBy(dx: 0.0, dy: -20.0)
bounds.size.height = bounds.height + 20.0
Run Code Online (Sandbox Code Playgroud)
同样在didFinishLaunchingWithOptions中的AppDelegate(他用Objective-C编写的应用程序)中,我尝试添加它,所有内容保持不变,没有任何更改:
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc]init]];
[[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f]];
[[UINavigationBar appearance] setTranslucent:YES];
Run Code Online (Sandbox Code Playgroud)
请帮忙解决问题,我搞乱了3天.
对不起,我的英语不好.
我创建了一个模糊视图并添加到主视图的子视图中。这是我的代码:
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.tintColor = UIColor.green
blurEffectView.tag = 999;
let frame:CGRect = CGRect(x: self.internalView.frame.size.width + self.internalView.frame.origin.x, y: self.drawerView.frame.origin.y, width: self.drawerView.frame.size.width - self.internalView.frame.size.width, height: self.drawerView.frame.size.height)
blurEffectView.frame = frame
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.drawerView.insertSubview(blurEffectView, belowSubview: self.btnClose)
Run Code Online (Sandbox Code Playgroud)
现在,我想将其设为深绿色模糊。
我如何使用上面的代码来实现这一点?
uiblureffect ×10
swift ×8
ios ×7
xcode ×2
blur ×1
blurry ×1
cornerradius ×1
ios8 ×1
react-native ×1
swift2 ×1
swift3 ×1
uibutton ×1
uitableview ×1
uiview ×1
view ×1