简体   繁体   中英

How to set image position programaticall in objective c?

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.

您忘记了:符号

selector:@selector(moveImage:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM