FTIndicator
FTIndicator copied to clipboard
Spinner disappearance stutters
Situation:
When user provide login, password and click "log in" then I show
[FTProgressIndicator showProgressWithmessage:nil userInteractionEnable:NO];
and after successful, app change controller :
- (void)loginSuccessful {
[FTProgressIndicator dismiss];
[[AMMainViewController sharedViewController]changeToControllerType:AMViewControllerTypeHome];
}
where changeToController looks like: `- (void)changeToControllerType:(AMViewControllerType)type userInfo:(NSDictionary *)userInfo { UIViewController *newVC = [AMViewControllerFactory viewControllerWithType:type];
if ([newVC isKindOfClass:[UINavigationController class]]) {
UIViewController *embededViewController = ((UINavigationController *)newVC).viewControllers.firstObject;
if ([embededViewController respondsToSelector:@selector(setUserInfo:)]) {
[embededViewController performSelector:@selector(setUserInfo:) withObject:userInfo];
}
} else if ([newVC respondsToSelector:@selector(setUserInfo:)]) {
[newVC performSelector:@selector(setUserInfo:) withObject:userInfo];
}
[self.currentVC willMoveToParentViewController:nil];
[self addChildViewController:newVC];
[self.view addSubview:newVC.view];
[newVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[newVC.view layoutIfNeeded];
newVC.view.alpha = 0.0f;
[self setNeedsStatusBarAppearanceUpdate];
[UIView animateWithDuration:0.25f
delay:0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
newVC.view.alpha = 1.0f;
} completion:^(BOOL finished){
[self.currentVC.view removeFromSuperview];
[self.currentVC removeFromParentViewController];
[newVC didMoveToParentViewController:self];
self.currentVC = newVC;
}];
} `
And indicator stutter. You can check it out or tell me how to get around this?
I am seeing the same or similar behavior, with a flickering/stuttering spinner.
Also, I am seeing the spinner show up in different x/y locations in one view controller vs. another.
Code for show: FTProgressIndicator.setProgressIndicatorStyle(.dark) FTProgressIndicator.showProgressWithmessage("message", userInteractionEnable: false)
Code for hide: FTProgressIndicator.dismiss()
I think the most possible reason for flickering/stuttering spinner is that it didn't stop timer when showing a new one. I just fixed it and hope it works...