嗨,我是新来的,也有Xcode的菜鸟请帮帮忙。 我正在尝试制作Imagepickercontroller,但我遇到一个错误,并且不知道如何解决它。
Viewcontroller.h
@interface ViewController : UIViewController<UIImagePickerControllerDelegate> {
IBOutlet UIButton *button;
IBOutlet UIImageView *image;
UIImagePickerController *imagepicker;
}
- (IBAction)change:(id)sender;
@end
Viewcontroller.m
@interface ViewController ()
@end
@implementation ViewController
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *mytouch = [[event allTouches] anyObject];
button.center = [mytouch locationInView:self.view];
}
- (void)viewDidLoad
{
[super viewDidLoad];
imagepicker = [[UIImagePickerController alloc] init];
[imagepicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagepicker setAllowsEditing:YES];
}
- (IBAction)change:(id)sender
{
[self presentViewController:imagepicker animated:YES completion:NO];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[UIImage(setimage:)image];
[self dismissViewControllerAnimated:YES completion:NO];
}
@end
预期标识符[UIImage(setimage:)image];
答案 0 :(得分:0)
[UIImage(setimage :)图像]需要是[someImageView setImage:image] 其中someImageView是UIImageView的实例
答案 1 :(得分:0)
请注意UIImage
是一个类,而不是一个对象。您应该给出UIImage
的类方法,不带任何括号。
此外,setImage:
不是 UIImage
的类方法。我想,你的意思是一个对象实例,而不是类对象。