专辑封面头像旋转
- (void)startAnimation
{imageangle = imageangle+0.5;
CGAffineTransform endAngle = CGAffineTransformMakeRotation(imageangle* (M_PI / 180.0f));
[UIView animateWithDuration:0.01 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
self.bacImage.transform = endAngle;
} completion:^(BOOL finished) {
[self startAnimation];
}];
}
裁剪圆形图片:给UIImage写一个分类
-(UIImage *)circleImage{
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);
CGContextAddEllipseInRect(ctx, rect);
CGContextClip(ctx);
[self drawInRect:rect];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}