-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex != actionSheet.cancelButtonIndex) {
UIImagePickerController* controller = [[UIImagePickerControlleralloc] init];
controller.delegate = self;
if (buttonIndex == 0) {
if (![UIImagePickerControllerisSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
return;
}
controller.sourceType = UIImagePickerControllerSourceTypeCamera;
}
else {
controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
controller.allowsEditing = NO;
[SharedAppDelegate.window.rootViewControllerpresentModalViewController:controller animated:YES];
}
}
枚举类型,没有初始化,默认会读取第一个的,