【问题标题】:How to set image position programaticall in objective c?如何在目标 c 中以编程方式设置图像位置?
【发布时间】:2012-01-17 12:08:42
【问题描述】:

我想在 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;
}

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

【问题讨论】:

    标签: objective-c ios xcode uiimageview uiimage


    【解决方案1】:

    你忘记了:符号

    selector:@selector(moveImage:)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-14
      • 2011-09-24
      • 2012-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多