-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in landscape mode #18
Comments
Hi @nemanja-nisic, I'm glad that you are using Malert! Malert does not have this support to set Alert's width, because Malert has an adaptive and flexible layout. I was thinking here and we can provide a landscape and a portrait margin to be set. Does this approach help you? |
Hi @vitormesquita Im sorry for the late reply. |
Just had the same issue with landscape mode so I did a small adjustment in extension UIWindow {
static var isLandscape: Bool {
if #available(iOS 13.0, *) {
return UIApplication.shared.windows
.first?
.windowScene?
.interfaceOrientation
.isLandscape ?? false
} else {
return UIApplication.shared.statusBarOrientation.isLandscape
}
}
}
class MalertPresentTransitioning: BaseTransitioning, UIViewControllerAnimatedTransitioning {
let containerHeight: CGFloat = 300
var originFrame: CGRect {
switch UIDevice.current.userInterfaceIdiom {
case .phone:
if UIWindow.isLandscape {
return CGRect(
x: UIScreen.main.bounds.minX,
y: UIScreen.main.bounds.midY - containerHeight / 2,
width: UIScreen.main.bounds.width,
height: containerHeight)
} else {
return UIScreen.main.bounds
}
case .pad:
return CGRect(
x: UIScreen.main.bounds.minX,
y: UIScreen.main.bounds.midY - containerHeight / 2,
width: UIScreen.main.bounds.width,
height: containerHeight)
default:
return UIScreen.main.bounds
}
}
} |
I have a following issue when my app goes to landscape mode. Do you have any suggestions?
I would like alert to be a fixed width instead of going almost entire width of the screen.
Thanks
The text was updated successfully, but these errors were encountered: