我试图动画一段圆的外观.为了存档这个我使用CABasicAnimations工作安静.
动画从顶部开始,很好地移动到整个圆圈的三分之一.但是当动画结束时,圆圈会立即被完全绘制.
我怎么能防止这种情况?
这是我的自定义UIView的源代码:
- (void)drawRect:(CGRect)rect
{
int radius = 100;
int strokeWidth = 10;
CGColorRef color = [UIColor redColor].CGColor;
int timeInSeconds = 5;
CGFloat startAngle = 0;
CGFloat endAngle = 0.33;
CAShapeLayer *circle = [CAShapeLayer layer];
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) cornerRadius:radius].CGPath;
circle.position = CGPointMake(CGRectGetMidX(self.frame)-radius, CGRectGetMidY(self.frame)-radius);
circle.fillColor = [UIColor clearColor].CGColor;
circle.strokeColor = color;
circle.lineWidth = strokeWidth;
[self.layer addSublayer:circle];
CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
drawAnimation.duration = timeInSeconds;
drawAnimation.repeatCount = 1.0;
drawAnimation.removedOnCompletion = NO;
drawAnimation.fromValue = [NSNumber numberWithFloat:startAngle];
drawAnimation.toValue …Run Code Online (Sandbox Code Playgroud) 我正在使用故事板.我有一个带有一个原型单元的UITableView.这个单元格的风格是"副标题".我已经从细胞中添加了一个segue到详细视图.因此,当用户点击一个单元格时,它将打开相应的编辑器......这一切都很有效.
现在我添加了一个UISearchDisplayController和一个UISearchBar,实现了委托.这非常有效.
但是在搜索结果表中,单元格的格式为"默认",并且不可点击.我需要做些什么才能使结果表看起来像"未搜索"表一样?