iphone - 分配会导致特定 iOS 配置出现意外结果

标签 iphone objective-c ios

我的 iOS 应用出现了一些非常奇怪的行为。它在模拟器和新硬件上运行良好,但当我在旧版 iPod Touch(软件版本 4.2.1)上使用发布配置测试它时,它无法正常运行。这是我拖动对象的代码(一个 UIView 子类):

- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event 
{
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self.superview];

// Set the correct center when touched 
touchPoint.x -= deltaX;
touchPoint.y -= deltaY;

NSLog(@"Touch moved1: %f %f, %f %f", touchPoint.x, touchPoint.y, self.center.x, self.center.y);
self.center = touchPoint;
NSLog(@"Touch moved2: %f %f, %f %f\n", touchPoint.x, touchPoint.y, self.center.x, self.center.y);
}

这是生成的日志输出:

Touch moved1: -43.000000 45.000000, 45.000000 41.000000
Touch moved2: 45.000000 45.000000, 45.000000 41.000000
Touch moved1: -44.000000 45.000000, 45.000000 41.000000
Touch moved2: 45.000000 45.000000, 45.000000 41.000000

如您所见,赋值 self.center = touchPoint 以某种方式更改了 touchPoint 的值。 x 和 y 值 touchPoint 变得等于 touchPoint.y,而不是在您拖动时跟随您的手指,这限制了对角线的移动。有什么建议吗?

最佳答案

该设备是 ARM6 设备吗?

某些版本的 Xcode 的 ARM6 代码生成中存在一个已知错误,会导致此类问题。尝试打开“其他 c 标志”build设置部分中的 -mno-thumb 选项,看看它是否有帮助。如果是这样,您可以有条件地仅为 ARM6 构建打开它。

参见:This item

关于iphone - 分配会导致特定 iOS 配置出现意外结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9074249/

相关文章:

iphone - 什么是适用于 iOS 的具有 bool 运算的优秀 3D 库

iphone - 更改数据编码

ios - 等待直到NSURLConnection sendAsynchronousRequest完成

objective-c - XPC服务支持多种协议(protocol)

ios - 使用 ReactiveCocoa 禁用 UIBarButtonItem

iphone - 将单元格的重新排序属性设置为 NO

iphone - Apple 是否已经在 Xcode 4 中解决了这些问题?

iphone - 显示自定义 NSManagedObject 的值

ios - 如何将 key 添加到NSMutableArray

objective-c - 微妙的图案背景 iOS png 文件