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

ios7 swipe back bug #48

Open
code1303009 opened this issue Apr 3, 2015 · 7 comments
Open

ios7 swipe back bug #48

code1303009 opened this issue Apr 3, 2015 · 7 comments

Comments

@code1303009
Copy link

when push a new viewcontroller,set the tabbar hide, then in the new viewcontroller, swipe to go back to first viewcontroller,offset of the contentview will be abnormal. It shows only in ios7.0+.
image

@code1303009
Copy link
Author

I had fix it by writing follow in your method - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated {
_tabBarHidden = hidden;
__weak DMTabBarController *weakSelf = self;

void (^block)() = ^{
    CGSize viewSize = weakSelf.view.bounds.size;
    CGFloat tabBarStartingY = viewSize.height;
    CGFloat contentViewHeight = viewSize.height;
    CGFloat tabBarHeight = CGRectGetHeight([[weakSelf tabBar] frame]);

    if (!tabBarHeight) {
        tabBarHeight = 49;
    }

    if (!hidden) {
        tabBarStartingY = viewSize.height - tabBarHeight;
        if (![[weakSelf tabBar] isTranslucent]) {
            contentViewHeight -= ([[weakSelf tabBar] minimumContentHeight] ?: tabBarHeight);
        }
        [[weakSelf tabBar] setHidden:NO];
    }

    [[weakSelf tabBar] setFrame:CGRectMake(0, tabBarStartingY, viewSize.width, tabBarHeight)];
    if ([[UIDevice currentDevice] systemVersion].floatValue >= 7.0 && [[UIDevice currentDevice] systemVersion].floatValue < 8.0) {
        [[weakSelf contentView] setFrame:[UIScreen mainScreen].bounds];
    }else{
        [[weakSelf contentView] setFrame:CGRectMake(0, 0, viewSize.width, contentViewHeight)];
    }
};

void (^completion)(BOOL) = ^(BOOL finished){
    if (hidden) {
        [[weakSelf tabBar] setHidden:YES];
    }
};

if (animated) {
    [UIView animateWithDuration:0.24 animations:block completion:completion];
} else {
    block();
    completion(YES);
}

}

@wy19901227
Copy link

you have fix this bug ,but the other bug come appear . The fram is not correct .

@code1303009
Copy link
Author

would you have better ideas?

@wy19901227
Copy link

这个bug,ios8已经完美解决了这个bug。但是毕竟不开源,我似乎找到了原因,问题就出现在pop这个方法里,苹果估计是在ios8修改了这个方法,所以要fix这个bug就要重写这个pop方法,或者你设置隐藏tabbar的时候animation改为NO就没有这个问题了。

@code1303009
Copy link
Author

虽然可能不是我需要的效果 但是还是谢谢你了

@cugbwxc
Copy link

cugbwxc commented Jul 14, 2015

iOS8 侧滑 会crash, POP 也可能crash,这个有解决么?

@code1303009
Copy link
Author

demo么? 我这里没有问题啊

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