Post

Replies

Boosts

Views

Activity

iOS 15 broke the navigation appearance when navigating to a view controller with a transparent navigation bar from a non-transparent navigation bar
On iOS 15, when navigating to a view controller that has a transparent navigation bar, the navbar animation isn't working as expected. It works as expected on iOS versions prior to 15. Please see attached video for iOS 14 Here's a video demonstration: https://www.dropbox.com/s/80d7qxzhql8fjj2/ios15%20transparent%20navbar%20delay.mov?dl=0 Demo project on Github: https://github.com/karlingen/NavigationTest This is how I've set up my view controllers: rootVC let appearance = UINavigationBarAppearance() appearance.configureWithDefaultBackground() appearance.backgroundColor = UIColor.red self.navigationController?.navigationBar.standardAppearance = appearance self.navigationController?.navigationBar.scrollEdgeAppearance = self.navigationController?.navigationBar.standardAppearance firstVC let appearance = UINavigationBarAppearance() appearance.configureWithTransparentBackground() self.navigationController?.navigationBar.standardAppearance = appearance self.navigationController?.navigationBar.scrollEdgeAppearance = self.navigationController?.navigationBar.standardAppearance secondVC let appearance = UINavigationBarAppearance() appearance.configureWithDefaultBackground() appearance.backgroundColor = UIColor.yellow self.navigationController?.navigationBar.standardAppearance = appearance self.navigationController?.navigationBar.scrollEdgeAppearance = self.navigationController?.navigationBar.standardAppearance The transition from secondVC to firstVC is smooth (going from yellow to transparent) but not from rootVC to firstVC (going from red to transparent): Has anyone found a workaround for this?
2
0
8.2k
Sep ’21
Setting background-color property of an HTML element with children in Safari iOS 15 doesn't work without manually redrawing the DOM element
The following way of setting the background color of an anchor tag in Safari on iOS 15 isn't working: <html> <head></head> <body><p><a class="content" href="#"><strong><span>Some content with background</span></strong></a> </p> <br /> <button onclick="javascript:onClick();">Click me to change content's background color</button> <script> function onClick(){ var element = document.getElementsByClassName('content')[0]; element.style.backgroundColor = "#888888"; } </script> </body> </html> I had to run the following hack after setting the backgroundColor in order for it to work: // Temporary workaround to redraw the element: var disp = element.style.display; element.style.display = 'none'; var trick = element.offsetHeight; element.style.display = disp; Video demonstration: https://www.dropbox.com/s/2z4kmsypj4ov4sd/iOS%2015%20webkit%20bug.mov?dl=0 Surely this is a bug in Safari unless I might've missed something?
1
0
2.8k
Oct ’21
Modifying the Y-position of navigation bar isn't possible in iOS 15.1 Beta / iOS 15 simulators
Our logic for modifying the navigation bar isn't working on devices running iOS 15.1 Beta or simulators running iOS 15.0 on Xcode 13. When scrolling, we want to change the position of the navigation bar so that it goes off screen to enable a so called fullscreen mode. Create a scroll view and implement UIScrollViewDelegate Inside scrollViewDidScroll, modify the Y-position of self.navigationController.navigationBar.frame Launch the app and scroll vertically Expected: Navbar is moved off screen when you scroll down and comes back when you scroll up. Actual: Navbar stays in position at all times. Workarounds: Use iOS 14 or below Here are two video demonstrations of Expected VS Actual results: iOS 14.5: https://www.dropbox.com/s/kplb13taioxrw7g/iOS14.5_scroll.mov?dl=0 iOS 15.0: https://www.dropbox.com/s/uyvy6oxcgi1wj8i/iOS15_scroll.mov?dl=0 Code: func scrollViewDidScroll(_ scrollView: UIScrollView) { if let navController = self.navigationController { var navBarFrame = navController.navigationBar.frame // Change y-position let newYPosition = min(0, max(-(navbarHeight), (scrollView.contentOffset.y * -1))) + statusBarHeight navBarFrame.origin.y = newYPosition navController.navigationBar.frame = navBarFrame NSLog("New Y positon: %f", newYPosition) } } And here's the full demo project: https://github.com/karlingen/NavbarHideOnScroll Is this a bug?
4
0
3k
Oct ’21