Hi,
I'm trying to animate a view where the drawRect draws a rounded rect using UIBezierPath.
if I do the animation the rounded rect seems to be stretched and olny if I add setNeedsDisplay it's display correctly (but even with this just at the end of the animation).
Am I missing something?
Code:
[UIView animateWithDuration:3.4 delay:0.0 options:0
animations:^{
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width + 50.0, self.frame.size.height);
[self setNeedsDisplay];
}
completion:nil];
Code:
- (void)drawRect:(CGRect)rect
{
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:18.0];
[[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5] setFill];
[path fill];
[[UIColor grayColor] setStroke];
path.lineWidth = 1.0;
[path stroke];
}