Post

Replies

Boosts

Views

Activity

Anybody know how to custom UIButton/UIView hover effect?
UIButton automatically obtains a hover highlight effect in visionOS, but both the highlighted area and the corner radius cannot be customized. I have attempted to modify the range and corner radius of UIPointerInteraction, but it does not work for visionOS. Regarding UIView, I have reviewed the documentation and it seems that there is no relevant API. Anybody know how to custom UIButton/UIView hover effect?
3
0
1.1k
Aug ’23
Safe area guide top anchor lost after force change orientation
Hi, I wrote a simple auto layout constraint below and used a force change orientation method to present a full-screen landscape view controller. imageView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 16) After the landscape view controller is dismissed, the safe area guide seems broken, the top safe area insets change to zero, and call layoutIfNeeded() won't fix this issue. The only way to fix this is back to Home Screen and reopen the app. This problem occurred on the iPhone SE simulator, newer devices with a notch don't have this issue. Does anybody know how to fix this? func forceOrientation(orientation: UIInterfaceOrientation) {     let value = orientation.rawValue     if #available(iOSApplicationExtension 16.0, iOS 16.0, *) {         let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene         var interfaceOrientations: UIInterfaceOrientationMask = []         switch orientation {         case .portrait:             interfaceOrientations = .portrait         case .landscapeLeft:             interfaceOrientations = .landscapeLeft         case .landscapeRight:             interfaceOrientations = .landscapeRight         case .portraitUpsideDown:             interfaceOrientations = .portraitUpsideDown         case .unknown:             interfaceOrientations = .portrait         @unknown default:             interfaceOrientations = .portrait         }         windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: interfaceOrientations))     } else {         UIDevice.current.setValue(value, forKey: "orientation")         UINavigationController.attemptRotationToDeviceOrientation()     } }
0
0
1.2k
Jan ’23