如何在目标c中以编程方式设置图像位置?

时间:2012-01-17 12:08:43

标签: objective-c ios xcode uiimageview uiimage

我想在3秒后将图像移动到另一个x,y坐标我尝试这个但是我得到了这样的错误:2012-01-17 14:01:11.417 YapiKrediDemo [2147:207] - [Sozlesme moveImage]:无法识别的选择器发送到实例0x6e07540我的代码是:

- (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;
}

我该如何解决这个问题?请帮助我,谢谢。

1 个答案:

答案 0 :(得分:4)

您忘记了:符号

selector:@selector(moveImage:)