I have an alert controller that I present to a user when a button is clicked. It pops up with several options for the user to select from. The controller naturally presents in the middle of the screen; however, I want to move it to the right side of the screen so that the user can access it via one hand when in landscape mode.
Example: Imagine the user is holding the phone sideways in their right hand, they click a button, and before the camera pulls up, an alert is presented asking them something. I want them to be able to interact with the alert without having to use their other hand. To do this, the alert needs to appear on the right side of the screen instead of in the center.
Example code:
Example: Imagine the user is holding the phone sideways in their right hand, they click a button, and before the camera pulls up, an alert is presented asking them something. I want them to be able to interact with the alert without having to use their other hand. To do this, the alert needs to appear on the right side of the screen instead of in the center.
Example code:
Code Block let alert = UIAlertController(title: "Type", message: "Please select a type.", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Burger", style: .default, handler: {(action:UIAlertAction!) in self.eatBurger() })) alert.addAction(UIAlertAction(title: "Pizza", style: UIAlertAction.Style.default, handler: {(action:UIAlertAction!) in self.eatPizza() })) present(alert, animated: true, completion: nil)