Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spinner disappearance stutters #11

Open
kszuba opened this issue Jan 31, 2017 · 2 comments
Open

Spinner disappearance stutters #11

kszuba opened this issue Jan 31, 2017 · 2 comments

Comments

@kszuba
Copy link

kszuba commented Jan 31, 2017

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?

@aarongfischer
Copy link

aarongfischer commented Feb 8, 2017

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()

@liufengting
Copy link
Owner

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants