这应该是一个简单的,基本上我有几个用核心图形绘制的路径,我希望能够旋转它们(为方便起见).我尝试过使用CGContextRotateCTM(context); 但它不会旋转任何东西.我错过了什么吗?
这是drawRect的来源
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 1.5);
CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextSetShadow(context, CGSizeMake(0, 1), 0);
CGContextBeginPath(context);
CGContextMoveToPoint(context, 13.5, 13.5);
CGContextAddLineToPoint(context, 30.5, 13.5);
CGContextAddLineToPoint(context, 30.5, 30.5);
CGContextAddLineToPoint(context, 13.5, 30.5);
CGContextAddLineToPoint(context, 13.5, 13.5);
CGContextClosePath(context);
CGContextMoveToPoint(context, 26.2, 13.5);
CGContextAddLineToPoint(context, 26.2, 17.8);
CGContextAddLineToPoint(context, 30.5, 17.8);
CGContextMoveToPoint(context, 17.8, 13.5);
CGContextAddLineToPoint(context, 17.8, 17.8);
CGContextAddLineToPoint(context, 13.5, 17.8);
CGContextMoveToPoint(context, 13.5, 26.2);
CGContextAddLineToPoint(context, 17.8, 26.2);
CGContextAddLineToPoint(context, 17.8, 30.5);
CGContextStrokePath(context);
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextSetShadowWithColor(context, CGSizeMake(0, 0), 0, [UIColor clearColor].CGColor);
CGContextFillRect(context, CGRectMake(26.2, 13.5, 4.3, 4.3));
CGContextFillRect(context, CGRectMake(13.5, …Run Code Online (Sandbox Code Playgroud) 我正在使用核心动画在我的应用程序中的不同视图状态之间进行转换.但是,我需要找到一种在动画完成后执行不同任务的方法.我知道我可以实现委托方法并使用
- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag;
Run Code Online (Sandbox Code Playgroud)
回调,但是没有简单的方法来跟踪哪个动画结束.
我可以想到一些繁琐的解决方案,比如使用一系列标志和计数器,但是我想知道是否有更有效和实用的方法来解决这个问题.
有什么想法?