-(void)cameraAndPhotoAlbums{
self.actionSheet = [[UIActionSheet alloc] initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:nil otherButtonTitles:@"Photo album",@"camera", nil];
[self.actionSheet showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==0) {
UIImagePickerController * imagePicker = [[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:imagePicker animated:YES completion:nil];
} else if(buttonIndex==1) {
UIImagePickerController * imagePicker = [[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:imagePicker animated:YES completion:nil];
}
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
[picker dismissViewControllerAnimated:YES completion:nil];
}
-(void)imagePickerControllerDidCancel:(id)picker{
[picker dismissViewControllerAnimated:YES completion:nil];
}
しかし、フォトアルバムの選択時には、キャンセルは実行されますが、実行しないでください。このアイテムはどこにも書き込めませんでした。エージェントは、ここで...didFinishPickingMediaWithInfoは動作しません
イメージピッカーコントローラの代理人を設定しましたか? – Bilal
質問をもう少し説明してください –
いくつかの追加コードを表示 –