【问题标题】:how to do undo on touch events如何撤消触摸事件
【发布时间】:2010-08-17 10:58:20
【问题描述】:

如何撤消触摸事件...

我使用 touchesBegan、touchesMoved 和 touchesEnded 画了一条线.....

现在我想做撤消操作来获取我之前在 iphone 上的状态....

任何人都可以帮助我如何在 iphone 上撤消操作?

提前谢谢....

【问题讨论】:

    标签: iphone cocos2d-iphone


    【解决方案1】:

    您必须在发送撤消消息时手动执行此操作。您需要保留所绘制内容的历史记录,最有可能以堆栈形式保存。

    然后,只需弹出撤消调用并恢复视图。

    堆栈可能应该只保存层,因此您可以在 pop 时将它们从 super 中删除。

    【讨论】:

    • 谢谢 Greelmo.... UIGraphicsPopContext() UIGraphicsPushContext() 我想我需要为撤消操作实现这个方法....
    猜你喜欢
    • 2018-01-19
    • 1970-01-01
    • 2015-02-08
    • 2015-01-20
    • 2011-07-06
    • 2014-12-04
    • 2016-07-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多