iphone - Swift in iOS: Resizing UIImage for Portrait or Landscape -


i trying create app allows users select pictures photo library on iphone , make uiimage view more responsive either portrait or landscape view of screen.

in view controller, have uiimage: uiimage in viewcontroller

then set 4 constraints on constraints

however, when select image photo library, size of picture not responsive portrait or landscape. size of picture seems smaller width (380) & height (419) of uiimage. landscape view

the relevant code uiimagepickercontroller is:

   self.pickedimage.image = image     self.pickedimage.contentmode = .scaleaspectfit 

so wondering how make size of picture responsive screen (landscape/portrait). thanks

it doing ordered to: top spacing of 16 pixels navigation bar , bottom spacing of 99 pixels toolbar. uiimageview wider image (you can check changing background color). if make margins smaller, see image increase in size.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -