ios - Image to Initially Fill UIImagePickerController -


in ios app i'd grab images photo library , crop them square format. uiimagepickercontroller takes care of nicely, there 1 little problem: when select landscape-oriented photo library not fill crop area (for portrait images does). allows user select non-square area. is there way force image picker fill crop area vertically horizontally - without implemeting own image picker?

my code:

class addprofileviewcontroller: uiviewcontroller, uigesturerecognizerdelegate, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate {      @iboutlet weak var profileimageview: enhancedimageview!     let imagepicker = uiimagepickercontroller()      override func viewdidload() {         super.viewdidload()          // ...          imagepicker.delegate = self     }      func profileimagetapped() {         imagepicker.allowsediting = true         imagepicker.sourcetype = .photolibrary         presentviewcontroller(imagepicker, animated: true, completion: nil)     }      func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) {         // ...     }      func imagepickercontrollerdidcancel(picker: uiimagepickercontroller) {         dismissviewcontrolleranimated(true, completion: nil)     } } 

selecting landscape image, looks this:

image picker horizontal image

instead, i'd image horizontally , vertically extend crop frame, image picker return square image.

to close question - here how solved it:

extending image vertically boundaries not seem possible standard image picker. options create own image picker or use following workaround might sufficient in cases:

if user not zoom in section of image center of image best approximation user wants, , square image cutting off equal-width slices on both sides.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -