-1
我使用石英核心框架为iOS创建绘画应用程序,如果我想添加撤消功能,应该怎么做?石英核心:撤消在iOS中的绘画应用程序
这里有一些代码段:
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 5.0);
CGContextSetLineCap(context, kCGLineCapRound);
[drawColor set];
for (Line *line in linesCompleted) {
[[line color] set];
CGContextMoveToPoint(context, [line begin].x, [line begin].y);
CGContextAddLineToPoint(context, [line end].x, [line end].y);
CGContextStrokePath(context);
}
}
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/UndoManager.html – 2014-10-30 02:26:59