开发者

Setting flash mode to off as default

I'm trying to set the camera flash mode in an UIImagePickerController to off, but I don'开发者_JAVA技巧t understand the reference page. Here is my code:

- (void)getMediaFromSource:(UIImagePickerControllerSourceType)sourceType {
NSArray *mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:sourceType];
if ([UIImagePickerController isSourceTypeAvailable:
     sourceType] && [mediaTypes count] > 0) {
    NSArray *mediaTypes = [UIImagePickerController
                           availableMediaTypesForSourceType:sourceType];
    mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil];
    UIImagePickerController *picker =
    [[UIImagePickerController alloc] init];
    UIImagePickerControllerCameraDevice *device;
    picker.mediaTypes = mediaTypes;
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = sourceType;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}}

I've tried setting picker.cameraDevice = UIImagePickerControllerCameraFlashModeOff, but this results in an error. The reference page says that cameraDevice is a property. Does this mean that I need to create that property myself, or is it located somewhere? 'Cause the camera works if I don't do anything to the code, but with flash mode set to auto...

There is obviously something I haven't understood. :/


replace picker.cameraDevice = UIImagePickerControllerCameraFlashModeOff with
picker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜