小编Shi*_*goo的帖子

圆段笔划的动画以完整笔划结束

我试图动画一段圆的外观.为了存档这个我使用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)

cocoa-touch core-animation objective-c cabasicanimation ios

7
推荐指数
1
解决办法
7735
查看次数

搜索结果UISearchDisplayController具有其他单元格布局和行为,而不是搜索表格

我正在使用故事板.我有一个带有一个原型单元的UITableView.这个单元格的风格是"副标题".我已经从细胞中添加了一个segue到详细视图.因此,当用户点击一个单元格时,它将打开相应的编辑器......这一切都很有效.

现在我添加了一个UISearchDisplayController和一个UISearchBar,实现了委托.这非常有效.

但是在搜索结果表中,单元格的格式为"默认",并且不可点击.我需要做些什么才能使结果表看起来像"未搜索"表一样?

cocoa-touch objective-c uitableview ios uistoryboard

6
推荐指数
2
解决办法
5046
查看次数