我正在构建这个应用程序并且非常成功。然而,我最近只是想改变用户选择上传图片的方式。它现在带有一个操作表。问题是,当单击按钮时,我尝试关闭操作表,然后启动图像库,但它不起作用。谢谢你的帮助!
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
[actionSheet dismissWithClickedButtonIndex:0 animated:NO];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:NULL];
}
///////////
UIActionSheet *actionsheet = [[UIActionSheet alloc]
initWithTitle:@"Submit Photo"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take Photo",@"Select Photo from Gallery", nil];
[actionsheet showInView:self.view];