问题
I want to move image to another x,y coordinates after 3 seconds I try this but I got an error like this: 2012-01-17 14:01:11.417 YapiKrediDemo[2147:207] -[Sozlesme moveImage]: unrecognized selector sent to instance 0x6e07540 My code is:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
image1=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"GirisButton.png"]];
[self.view addSubview:image1];
[NSTimer scheduledTimerWithTimeInterval: 3
target: self
selector:@selector(moveImage)
userInfo: nil repeats:YES];
}
- (void)moveImage:(NSTimer*)timer{
//[image1 setCenter: CGPointMake(634, 126)];
CGRect myFrame = image1.frame;
myFrame.origin.x = 634;
myFrame.origin.y = 126;
image1.frame = myFrame;
}
How can I solve this? Please help me, thanks.
回答1:
You have forgotten : symbol
selector:@selector(moveImage:)
来源:https://stackoverflow.com/questions/8894335/how-to-set-image-position-programaticall-in-objective-c