How to set image position programaticall in objective c?

爱⌒轻易说出口 提交于 2019-12-10 23:30:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!