以下のメソッドを取得する方法を教えてもらえますかsender button Tag/Name/ID
?
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
// I Want to get the sender button reference here
}
以下のメソッドを取得する方法を教えてもらえますかsender button Tag/Name/ID
?
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
// I Want to get the sender button reference here
}
picker.view.tag を使用して UIImagePickerController タイプを識別できます。UIImagePicker を呼び出すたびに、そのビューのタグを設定できます。
異なる画像ピッカーを識別するために同じものを使用しました。
編集
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.allowsEditing = YES;
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.view.tag = 5;//set the tag here
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editingInfo { NSLog(@"%d",picker.view.tag); }
設定したタグの値を取得します。
これを試して
-(IBAction)ownMethod:(id)sender
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.allowsEditing = YES;
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
**imagePickerController.view.tag = [sender tag];//set the tag of button to picker tag **
[self presentViewController:imagePickerController animated:YES completion:nil];
}