预期的标识符图像

时间:2013-04-25 16:24:00

标签: xcode

嗨,我是新来的,也有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];

2 个答案:

答案 0 :(得分:0)

[UIImage(setimage :)图像]需要是[someImageView setImage:image] 其中someImageView是UIImageView的实例

答案 1 :(得分:0)

请注意UIImage是一个类,而不是一个对象。您应该给出UIImage的类方法,不带任何括号。 此外,setImage: 不是 UIImage的类方法。我想,你的意思是一个对象实例,而不是类对象。