iphone - 如何根据给定的坐标移动 UIImage

标签 iphone objective-c ios xcode

我想知道是否有一种方法可以让 UIImage 根据程序中给出的多个坐标移动,例如:一个坐标将从左到右移动 10 个像素 第二个坐标将从上一个坐标继续,从上到下移动 20 个像素,依此类推

最佳答案

您可以进行如下操作

- (IBAction) doMoveLeft : (UIImageView *) sender
{
    yourImageView=sender; //Make yourImageView globally accessible.
    [yourImageView setFrame:(X,Y,Width,Height)];
}

/*
> Increase or Decrease your X,Y as per the requirement. Make (X,Y) of int type. 
And Put them at global to access it where you need!

> At the time of showing images on your view, you can also give them dynamic 
tags to distinguish them for further use.
*/

关于iphone - 如何根据给定的坐标移动 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9695576/

相关文章:

iphone - 使用 Flurry 记录 __FILE__

iphone - 使用 iOS 中的加速度计进行跳跃检测

iphone - 如何在 iPhone 中编辑地址簿中的联系人?

iphone - 初学者 iPhone 开发问题

ios - 在ios中对textField设置多重验证

ios - 使用 Alamofire (Swift 2) 从 JSON 填充表格 View 单元格

ios - Facebook 解析链接器错误

ios - Keychain Access 和 Push Notification Entitlement 警告对 iTunes Connect 的 future 影响

iphone - 如何在 objective-c 中的现有字符串的开头添加一个字符?

ios - 无法在 Xcode 6 中构建模块 'Foundation'