gpt4 book ai didi

IOS/objective-C/imagePicker : Skip 'Choose' step

转载 作者:行者123 更新时间:2023-11-28 19:42:18 25 4
gpt4 key购买 nike

我的 uiimagepicker Controller 方法让用户选择照片,一旦选择,就会询问用户是否要“选择照片”。

然而,我遇到了另一个跳过这一步的项目。那一刻,用户点击照片,它被选中,选择器被关闭,我们在原始 Controller 中看到图像。我更喜欢这个,因为它更快。

谁能解释一下如何跳过“选择”步骤?

Here is my code:
- (IBAction)selectPhoto:(id)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

[self presentViewController:picker animated:YES completion:NULL];

}

#pragma mark - Image Picker Controller delegate methods

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
self.imageView.image = chosenImage;
self.changedPic=YES;
[picker dismissViewControllerAnimated:YES completion:NULL];

}

这是跳过这一步的其他代码:

- (IBAction) pickImage:(id)sender{

UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
pickerController.delegate = self;
[self presentViewController:pickerController animated:YES completion:nil];
}

#pragma mark -
#pragma mark UIImagePickerControllerDelegate

- (void) imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
self.imageView.image = image;
pngData = UIImagePNGRepresentation(image);
[self dismissModalViewControllerAnimated:YES];
}

我没有立即看出是什么导致了差异,但也许有一些委托(delegate)方法或其他方法可以做到这一点。感谢您的任何建议。

最佳答案

刚刚设置

 picker.allowsEditing = NO;

动图

enter image description here

关于IOS/objective-C/imagePicker : Skip 'Choose' step,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33894215/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com