mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
Merge pull request #868 from NativeScript/camera-ios9
code refactored to support ios9
This commit is contained in:
@ -91,10 +91,12 @@ export var takePicture = function (options?: definition.CameraOptions): Promise<
|
|||||||
}
|
}
|
||||||
imagePickerController.delegate = listener;
|
imagePickerController.delegate = listener;
|
||||||
|
|
||||||
if (UIDevice.currentDevice().model !== "iPhone Simulator") {
|
var sourceType = UIImagePickerControllerSourceType.UIImagePickerControllerSourceTypeCamera;
|
||||||
// UIImagePickerControllerSourceType.UIImagePickerControllerSourceTypeCamera is not available in emulators!
|
var mediaTypes = UIImagePickerController.availableMediaTypesForSourceType(sourceType);
|
||||||
imagePickerController.mediaTypes = UIImagePickerController.availableMediaTypesForSourceType(UIImagePickerControllerSourceType.UIImagePickerControllerSourceTypeCamera);
|
|
||||||
imagePickerController.sourceType = UIImagePickerControllerSourceType.UIImagePickerControllerSourceTypeCamera;
|
if (mediaTypes) {
|
||||||
|
imagePickerController.mediaTypes = mediaTypes;
|
||||||
|
imagePickerController.sourceType = sourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
imagePickerController.modalPresentationStyle = UIModalPresentationStyle.UIModalPresentationCurrentContext;
|
imagePickerController.modalPresentationStyle = UIModalPresentationStyle.UIModalPresentationCurrentContext;
|
||||||
|
Reference in New Issue
Block a user