Post

Replies

Boosts

Views

Activity

The height drawn in safeAreaInsets.bottom and Toolbar is different on iPad with SafeArea.
On an iPad with SafeArea, the height drawn in safeAreaInsets.bottom and Toolbar are different, so there is a gap between the Toolbar and the bottom. class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.navigationController?.setToolbarHidden(false, animated: false) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let insetsBottom = self.view.safeAreaInsets.bottom let screenHeight = UIApplication.shared.keyWindow?.bounds.size.height ?? 0 let toolbarFrameY = (self.navigationController?.toolbar.frame.origin.y ?? 0) print("safeAreaInsets.bottom=\(insetsBottom), toolbar.height with safeArea=\(screenHeight - toolbarFrameY)") } } But, When "Shows Toolbar" is checked in Storyboard, safeAreaInsets.bottom and the height drawn on the Toolbar match. Why is the behavior different? Is there any way to deal with this in code? Version/Build iOS15 Xcode 13.1 iPad mini 6th
0
0
579
Dec ’21
BackgroudColor of UINavigationBarAppearance() does not work in iOS15.
The background color of the navigation bar of "Photo Library" displayed by WKWebView in iOS15 does not work with the backgroudColor of UINavigationBarAppearance(). It works on iOS14. AppDelegate.swift if #available(iOS 15, *) { let appearance = UINavigationBarAppearance() appearance.backgroundColor = .red UINavigationBar.appearance().standardAppearance = appearance UINavigationBar.appearance().scrollEdgeAppearance = appearance UINavigationBar.appearance().compactAppearance = appearance } else { UINavigationBar.appearance().barTintColor = .red } ViewController.swift let webConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.uiDelegate = self webView.navigationDelegate = self view = webView guard let path: String = Bundle.main.path(forResource: "index", ofType: "html") else { fatalError() } let myURL = URL(fileURLWithPath: path, isDirectory: false) self.webView.loadFileURL(myURL, allowingReadAccessTo: myURL) index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Sample</title> </head> <body> <input type="file" name="example" accept="image/jpeg,image/png"> </body> </html> Version/Build iOS 15 RC Xcode 13 RC
2
0
1.4k
Sep ’21