0

Hi i am new here and also a noob with Xcode please help. I am trying to make Imagepickercontroller but i am having trouble with one error and don't know how to solve it.

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

Expected identifier [UIImage(setimage:)image];

4

2 回答 2

0

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

于 2013-04-25T16:47:20.690 回答
0

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

于 2013-04-25T16:48:11.063 回答