NSUndoManager and GLKit

3

我正在尝试在一个使用GLKit的iOS应用中支持撤销/重做。

当我尝试以下操作时:

GLKVector3 currentTranslation = _panningObject.translation;
[[self.undoManager prepareWithInvocationTarget:_panningObject] setTranslation:currentTranslation];

我遇到了崩溃问题:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSMethodSignature signatureWithObjCTypes:]: unsupported type encoding spec '(' in '4(_GLKVector3={?=fff}{?=fff}{?=fff}[3f])8''

有什么想法吗?

“_panningObject”是什么?你可能需要提供更多的信息…… - cacau
它是一个具有类型为GLKVector3的翻译属性的对象。 - Tom Irving
дёЂдёЄжґѕз”џи‡ЄNSObjectзљ„Objective-CеЇ№и±Ў..? - cacau
是的,就是那个 :) - Tom Irving
请查看我的回答中的推文链接。解释了问题。 - Tom Irving
显示剩余3条评论
1个回答

0

仍然不知道为什么GLKVector3表现不友好,但我将其作为解决方法使用:

- (void)setObject:(DrawableObject *)object translationX:(CGFloat)x y:(CGFloat)y z:(CGFloat)z {

    GLKVector3 translation = GLKVector3Make(x, y, z);
    GLKVector3 currentTranslation = object.translation;
    [[self.undoManager prepareWithInvocationTarget:self] setObject:object
                                                      translationX:currentTranslation.x y:currentTranslation.y z:currentTranslation.z];

    [object setTranslation:translation];
}

编辑:

https://twitter.com/bddckr/status/370144778090192896 https://twitter.com/bddckr/status/370145021804425216


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接