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''

有任何想法吗?

4

1 回答 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

于 2013-08-20T13:11:01.233 回答