有人可以指导我使用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];
}