나의 제안 :
프로그래밍 방식 번째 이미지를 그릴 당신 '된 swoosh'이미지에 대한 마스크로 적용하고 주기적으로이 작업을 반복합니다. 왼쪽에서
예는, (오른쪽에서 마스크)
{
//existing variables
IBOutlet UIImageView *swooshView;
}
-(UIImage *)maskImageOfSize:(CGSize)size filledTo:(CGFloat)percentage{
UIGraphicsBeginImageContextWithOptions (size, NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColourWithColour (context, [UIColor blackColor].CGColor);
CGRect fillRect = CGRectZero;
fillRect.size.height = size.height;
fillRect.size.width = size.width * percentage/100.0;
fillRect.origin.x = (size.width - fillRect.size.width);
CGContextFillRect(context, fillRect);
UIImage *result = UIGraphicsGetImageFromImageContext();
UIGraphicsEndImageContext();
return result;
}
-(void)fillSwooshToPercentage:(CGFloat)percentage{
percentage = ((CGFloat) fmaxf (0.0 , (fminf (100.0, (float) percentage)));
// just policing a 'floor' and 'ceiling'...
swooshView.layer.mask = [self maskImageOfSize:self.swoosh.bounds.size filledTo:percentage];
}
출처
2014-11-01 23:37:19
Jef
을 된 swoosh을 그리고 필요에 따라 채 웁니다 자신의 컨트롤을 만듭니다 이미지를 입력합니다. – rmaddy