WDImagePicker
WDImagePicker copied to clipboard
Not supported for camera?
thanks
+1
+1
+1
+1
You can change the WDImagePicker class's init method to take the source type as Camera
override public init() {
super.init()
self.cropSize = CGSizeMake(320, 320)
_imagePickerController = UIImagePickerController()
_imagePickerController.delegate = self
_imagePickerController.sourceType = .Camera
}
Or you can write your own custom init method to switch to camera or photoGallery,
override public init(withSourceType sourceType : UIImagePickerControllerSourceType) {
super.init()
self.cropSize = CGSizeMake(320, 320)
_imagePickerController = UIImagePickerController()
_imagePickerController.delegate = self
_imagePickerController.sourceType = .sourceType
}
and then, initialise like this
self.imagePicker = WDImagePicker.init(withSourceType: .Camera) // For Camera
or
self.imagePicker = WDImagePicker.init(withSourceType: .PhotoLibrary) //For Gallery
You can add a convenience initializer as follows;
convenience init(_ sourceType : UIImagePickerControllerSourceType) { self.init() _imagePickerController.sourceType = sourceType }
self.imagePicker.imagePickerController.sourceType = .camera