Thursday, August 27, 2026
HomeiOS Developmentios - Visible Impact View's Blur does not work on UIView from...

ios – Visible Impact View’s Blur does not work on UIView from xib

[ad_1]

I created a customized Numpad keyboard by means of xib and needed so as to add a blur impact to its background. So I add a Visible Impact View in xib:

Important View and Visible Impact View background colour is about to Default and I additionally tried to make use of Clear Shade.

The issue is once I initialize the Numpad, background has a lightweight gray colour with none blur impact:

The way to add a blur impact to the Numpad so yellow sq. might be blurred and visual?

Code for NumpadView:

import UIKit

class NumpadView: UIView {

@IBOutlet weak var resetButton: NumpadButton!
@IBOutlet weak var decimalButton: NumpadButton!

var goal: UITextInput?
var view: UIView?

init(goal: UITextInput, view: UIView) {
    tremendous.init(body: .zero)
    self.goal = goal
    self.view = view
    initializeSubview()
}

required init?(coder: NSCoder) {
    tremendous.init(coder: coder)
    initializeSubview()
}

func initializeSubview() {
    let xibFileName = "NumpadView"
    let view = Bundle.principal.loadNibNamed(xibFileName, proprietor: self, choices: nil)![0] as! UIView
    self.addSubview(view)
    view.body = self.bounds
    self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
}

Code for initializing in a VC:

import UIKit

class NumpadViewController: UIViewController, UITextFieldDelegate {

@IBOutlet weak var textField: UITextField!

override func viewDidLoad() {
    tremendous.viewDidLoad()
    textField.delegate = self
    textField.inputView = NumpadView(goal: textField, view: view)
}
}

Take a look at challenge on Github

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments