yakovlevvl
yakovlevvl

Reputation: 524

Different UI for iPad and iPhone

In my app I have browser and UI for iPad and iPhone should be different. I don't use storyboards and write all programmatically. Also, when user taps on "downloadsButton", there will be different behavior. On iPhone a new controller with full screen size will appear from bottom, but on iPad a little square view will appear in the center of screen. How can I do this properly ?

iPhone

enter image description here

iPad

enter image description here

Upvotes: 2

Views: 1083

Answers (1)

mugx
mugx

Reputation: 10105

Let's say you touch downloadButton to invoke downloadAction, then you may try to change the modalPresentationStyle (of the view controller you want to show) doing so:

func downloadAction() {
  let downloadVc = DownloadViewController()
  downloadVc.modalPresentationStyle = UIDevice.current.userInterfaceIdiom == .pad ? .formSheet : .fullScreen
  self.present(downloadVc, animated: true, completion: nil)
}

Upvotes: 1

Related Questions