Andrii Yanechko
08/02/2024, 2:36 AMUIDatePicker
is not centered ?
Simulator, iOS 17 🧵
Same on the real deviceAndrii Yanechko
08/02/2024, 2:37 AMAndrii Yanechko
08/02/2024, 2:38 AMval controller = LocalUIViewController.current
val controllerView = controller.view
val screenWidth = UIScreen.mainScreen.bounds.useContents { size.width }.toDouble()
val screenHeight = UIScreen.mainScreen.bounds.useContents { size.height }.toDouble()
UIDatePicker(
frame = CGRectMake(
x = 0.0,
y = screenHeight - datePickerHeight,
width = screenWidth,
height = datePickerHeight
)
Andrii Yanechko
08/02/2024, 3:44 AMUIDatePicker
initialization:
translatesAutoresizingMaskIntoConstraints = false
controllerView.addSubview(this)
NSLayoutConstraint.activateConstraints(
listOf(
this.leftAnchor.constraintEqualToAnchor(controllerView.leftAnchor),
this.rightAnchor.constraintEqualToAnchor(controllerView.rightAnchor),
this.bottomAnchor.constraintEqualToAnchor(controllerView.bottomAnchor),
)
)
Mofe Ejegi
10/19/2024, 12:57 PM