objective-c - 如何在 objective-c 中以编程方式设置图像位置?
<p><p>我想在 3 秒后将图像移动到另一个 x,y 坐标我尝试了这个但我收到了这样的错误:2012-01-17 14:01:11.417 YapiKrediDemo -:无法识别的选择器发送到实例 0x6e07540 我的代码是:</p>
<pre><code>- (void)viewDidLoad
{
;
// Do any additional setup after loading the view from its nib.
image1=[ initWithImage:];
;
[NSTimer scheduledTimerWithTimeInterval: 3
target: self
selector:@selector(moveImage)
userInfo: nil repeats:YES];
}
- (void)moveImage:(NSTimer*)timer{
//;
CGRect myFrame = image1.frame;
myFrame.origin.x = 634;
myFrame.origin.y = 126;
image1.frame = myFrame;
}
</code></pre>
<p>我该如何解决这个问题?请帮助我,谢谢。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>你忘记了 <code>:</code> 符号</p>
<pre><code>selector:@selector(moveImage:)
</code></pre></p>
<p style="font-size: 20px;">关于objective-c - 如何在 objective-c中以编程方式设置图像位置?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/8894335/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/8894335/
</a>
</p>
页:
[1]