맞춤로드 표시기를 만듭니다. 그래서,이탐색 후 애니메이션이 중지됩니다.
@property (nonatomic, readonly) CAShapeLayer *progressLayer;
@property (nonatomic, readwrite) BOOL isAnimating;
- (void)layoutSubviews {
[super layoutSubviews];
self.progressLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds));
[self updatePath];
}
- (void)updatePath {
CGPoint center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
CGFloat radius = MIN(CGRectGetWidth(self.bounds)/2, CGRectGetHeight(self.bounds)/2) - self.progressLayer.lineWidth/2;
CGFloat startAngle = 3 * M_PI_2;
CGFloat endAngle = self.endAngle;
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
self.progressLayer.path = path.CGPath;
}
애니메이션처럼 내보기를 업데이트는
- (void)startAnimating {
if (self.isAnimating)
return;
CABasicAnimation *animation = [CABasicAnimation animation];
animation.keyPath = @"transform.rotation";
animation.duration = 1.0f;
animation.fromValue = @(0.0f);
animation.toValue = @(2 * M_PI);
animation.repeatCount = INFINITY;
[self.progressLayer addAnimation:animation forKey:kLLARingSpinnerAnimationKey];
self.isAnimating = true;
}
- (void)stopAnimating {
if (!self.isAnimating)
return;
[self.progressLayer removeAnimationForKey:kLLARingSpinnerAnimationKey];
self.isAnimating = false;
}
- (CAShapeLayer *)progressLayer {
if (!_progressLayer) {
_progressLayer = [CAShapeLayer layer];
_progressLayer.strokeColor = self.tintColor.CGColor;
_progressLayer.fillColor = nil;
_progressLayer.lineWidth = 1.5f;
}
return _progressLayer;
}
내가 탭 표시 줄 응용 프로그램을 여기에서 시작되므로 애니메이션 시작, 내가 다른 탭을 클릭 한 다음 처음에 반환 할 때 문제입니다 내 사용자 지정 표시기가 움직이지 않습니다. 셀에 지표를 추가하면이 버그 (기능)가 콜렉션보기 셀에 나타납니다. 나는 간단한 방법 addSubview를 호출하여 내 표시기를 추가
[view addSubview:indicator];
[indicator startAnimating];
가 어떻게 탐색 한 후 정지 애니 메이팅을 방지 할 수 있습니까? 미리 감사드립니다.
다음
TabBar 앱에서 한 뷰에서 다른 뷰로 이동하면 해당 뷰의 범위가 해제되어 objet가 활성 상태가됩니다. 또한 표시기의 기본 사용법은 서비스/작업이 완료 될 때까지 기다려야한다는 것을 사용자에게 알려주고 표시기가 완료 될 때까지 tabBar 선택 인덱스를 비활성화해야합니다. 나머지는 모두 응용 프로그램 사용에 따라 달라집니다. 추천 UI는 앱의 일부입니다. – nikhil84
@ walle84하지만 UIActivityIndicatorView가 정상적으로 작동하고 멈추지 않는 이유는 무엇입니까? –
이 줄이 보이지 않았습니다. "내 사용자 지정 표시기가 움직이지 않습니다.". 그렇다면 어떤 의미에서 움직이지 않습니까? – nikhil84