iOS Question Objective C to B4i Set Screen Orientation

astronald

Active Member
Licensed User
Longtime User
After IOS 16 canot change screen orientation with

Orientation:
no.Initialize ("UIDevice").RunMethod ("currentDevice", Null).SetField ("orientation", 3)


I found this code can anywhere help me pass to B4X

Objective-C:
        if #available(iOS 16.0, *) {
            DispatchQueue.main.async {
                let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
                self.setNeedsUpdateOfSupportedInterfaceOrientations()
                self.navigationController?.setNeedsUpdateOfSupportedInterfaceOrientations()
                windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: .landscape)) { error in
                    print(error)
                    print(windowScene?.effectiveGeometry ?? "")
                }
            }
        }else{
            UIDevice.current.setValue(UIInterfaceOrientation.landscapeLeft.rawValue, forKey: "orientation")
        }


Thanks for your time.
 

astronald

Active Member
Licensed User
Longtime User
Can someone help me?
the window loads very badly, i try with inline objc but fire error on first line.
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
Can someone help me?
the window loads very badly, i try with inline objc but fire error on first line.
Please read more here .
 
Upvote 0

astronald

Active Member
Licensed User
Longtime User
Thanks, i think on page resize remove all views and let only label with text please turn your phone.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…