Last active
November 5, 2024 16:13
-
-
Save likil33/4387cf79bc7505f16133517b5a2a3ca9 to your computer and use it in GitHub Desktop.
All - Simple stuff - code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =========================== UIView - Placed on VC ======================= | |
| UIApplication.shared.keyWindow?.addSubview(self.resetView) | |
| self.resetView.frame.size.height = (self.navigationController?.view.bounds.height)! | |
| self.resetView.frame.size.width = self.view.bounds.width | |
| self.resetView.alpha = 0.0 | |
| let tap = UITapGestureRecognizer(target: self, action: #selector(resetViewTapped)) | |
| self.resetView.addGestureRecognizer(tap) | |
| //MARK:- Dismiss keyboard | |
| @objc func resetViewTapped(tap:UITapGestureRecognizer){ | |
| self.resetCodeTxt.textContentType = .none | |
| self.resetCodeTxt.resignFirstResponder() | |
| self.newPasswordTxt.resignFirstResponder() | |
| } | |
| override func viewWillAppear(_ animated: Bool) { | |
| super.viewWillAppear(animated) | |
| self.view.addSubview(self.resetView) | |
| } | |
| @IBAction func CloseBtnClick(_ sender: Any) { | |
| DispatchQueue.main.async { [self] in | |
| UIView.animate(withDuration: 0.3) { self.resetView.alpha = 0.0 } | |
| } | |
| } | |
| DispatchQueue.main.async { | |
| UIView.animate(withDuration: 0.3) { self.resetView.alpha = 1.0 } | |
| } | |
| =========================== Customview - Navigation bar height ======================= | |
| @IBOutlet weak var NavigationView: UIView! | |
| @IBOutlet weak var navigationHeightConst: NSLayoutConstraint! | |
| NavigationView.backgroundColor = UIColor.init(hex: "#FD612B") | |
| navigationHeightConst.constant = NavHeight | |
| let NavHeight = NavStatusheight + | |
| (UINavigationController().navigationBar.frame.height) | |
| let window1 = UIApplication.shared.windows.filter {$0.isKeyWindow}.first | |
| let NavStatusheight = window1?.windowScene?.statusBarManager?.statusBarFrame.height ?? 20 | |
| let NavBarHeight = UINavigationController().navigationBar.frame.height | |
| 2) | |
| /MARK:- Navifation bar prperity | |
| let window1 = UIApplication.shared.windows.filter {$0.isKeyWindow}.first | |
| if #available(iOS 13.0, *) { | |
| let NavStatusheight = window1?.windowScene?.statusBarManager?.statusBarFrame.height ?? 20 | |
| let NavHeight = NavStatusheight + | |
| (UINavigationController().navigationBar.frame.height) | |
| self.navHeightConstrain.constant = NavHeight | |
| } | |
| else { | |
| let NavBarHeight = UINavigationController().navigationBar.frame.height | |
| self.navHeightConstrain.constant = NavBarHeight | |
| } | |
| =============================================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment