drawRect和reDrawView更改为
- (void)redrawView:(CADisplayLink *)displayLink {
if ( _interactionState == gif ) {
imageView.animatedImage = image;
imageView.frame = CGRectMake(40, 0, 70, 70);
imageView.tag = 17;
[self addSubview:imageView];
}
if( _interactionState == image ) {
UIView *viewToRemove = [self viewWithTag:17];
[viewToRemove removeFromSuperview];
}
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)frame {
CGContextRef context = UIGraphicsGetCurrentContext();
UIBezierPath* micPath = [UIBezierPath bezierPathWithRect: CGRectMake(40, 0, 70, 70)];
CGContextSaveGState(context);
[micPath addClip];
CGContextScaleCTM(context, 1, -1);
CGContextDrawTiledImage(context, CGRectMake(40, 0, 70, 70), micImage.CGImage);
CGContextRestoreGState(context);
[self setNeedsDisplay];
}