如何在目标c中以编程方式设置图像位置? [英] How to set image position programaticall in objective c?

查看:42
本文介绍了如何在目标c中以编程方式设置图像位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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:)

这篇关于如何在目标c中以编程方式设置图像位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆