0

I have a iPhone and iPad both with iOS 12.1 installed, when compiling my swift code via Xcode 10.1 and testing my app, I've noticed that when I start to upload, my sub-view is in the right position on an iPad, however when I us my iPhone, to test the app, the sub-view moves to the near center of the UIAlertController message, on screen.

I'm thinking it something to do with the screen size changing, with the iPad and iPhone, which is making the alert message on screen shrink a bit in size, then the progress bar is moving up the alert message a little. I'm not sure if its my code, I've added a picture of this and my code below. Any help with this would be a blessing, I thank you in advance.

 var alert : UIAlertController!
 var progressUpload : UIProgressView!

 self.alert = UIAlertController(title: "Updating", 
                              message: "Please wait for update to complete..",
                              preferredStyle: .alert)
 self.alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: 
                              { (action: UIAlertAction!) in }))

 let rect = CGRect(x: 10, y: 70, width: 220, height: 0)
 self.progressUpload = UIProgressView(frame: rect)
 self.progressUpload.setProgress(0.0, animated: true)
 self.progressUpload.transform = CGAffineTransform(scaleX: 1, y:2)
 self.progressUpload.progressTintColor = UIColor.blue
 self.progressUpload.layer.cornerRadius = 5
 self.progressUpload.clipsToBounds = true
 //adds to alert message
 self.alert.view.addSubview(self.progressUpload)

 self.present(self.alert, animated: true, completion: nil)

enter image description here

Jonas
  • 474
  • 3
  • 17
  • You'll want to read up on size classes. Here's something to get you started. https://medium.com/zendesk-engineering/ios-how-to-add-adaptive-constraints-to-support-a-universal-app-273663475b12 – Adrian Nov 03 '18 at 12:51
  • Is this not more about adjusting the frame in the sub-view or something like that? – Jonas Nov 04 '18 at 09:30

0 Answers0