- (void)openPhotoLibrary
{
UIImagePickerController * pickerImage = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
pickerImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
pickerImage.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:pickerImage.sourceType];
}
pickerImage.delegate = self;
pickerImage.allowsEditing = ![self.isNeedNotEdit boolValue];
pickerImage.navigationBar.barStyle = UIBarStyleDefault;
pickerImage.navigationBar.translucent = YES;
[self presentViewController:pickerImage animated:YES completion:nil];
}
/**
* 拍照
*/
- (void)openCamera
{
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = ![self.isNeedNotEdit boolValue];
picker.sourceType = sourceType;
[picker.navigationBar setTintColor:[UIColor blackTitleColor]];
picker.navigationBar.barStyle = UIBarStyleDefault;
picker.navigationBar.translucent = YES;
[self presentViewController:picker animated:YES completion:nil];
}
else
{
NSLog(@"设备不支持拍照");
}
}