简体   繁体   English

NSUndoManager和GLKit

[英]NSUndoManager and GLKit

I'm trying to support undo/redo in an iOS app that uses GLKit . 我正在尝试在使用GLKit的iOS应用中支持撤消/重做。

When I try the following: 当我尝试以下内容时:

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

I get a crash: 我遇到了崩溃:

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

Any ideas? 有任何想法吗?

Still got no idea why GLKVector3 won't play nice, but I'm using this as a workaround: 仍然不知道为什么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];
}

EDIT: 编辑:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM