D
D
deleted-mezhevikin2013-11-11 17:37:24
iOS
deleted-mezhevikin, 2013-11-11 17:37:24

Problem with custom TabBarController in ios7 [video question]?

I use a custom tabbar - AKTabBarController
In ios 7, there is a bug, if you go to a controller with a hidden tabbar and go back, it is impossible to scroll the table to the end.
The contentView height is calculated in AKTabBarView.m and is calculated correctly.
What could be the reason for such a bug in ios7?

- (void)layoutSubviews
{
    [super layoutSubviews];
    _tabBar.frame = (CGRect) {
        .origin.x = _tabBar.frame.origin.x,
        .origin.y = (self.tabBarPosition == AKTabBarPositionTop) ? 0.0
                                                                 : CGRectGetHeight(self.bounds) - CGRectGetHeight(_tabBar.bounds),
        .size = _tabBar.frame.size
    };

    _contentView.frame = (CGRect) {
        .origin.x = 0,
        .origin.y = (self.tabBarPosition == AKTabBarPositionTop) ? CGRectGetMaxY(_tabBar.frame) : 0,
        .size.width = CGRectGetWidth(self.bounds),
        .size.height = CGRectGetHeight(self.bounds) - ((!_isTabBarHidding) ? CGRectGetHeight(_tabBar.bounds) : 0)
    };
    NSLog(@"%f", _contentView.frame.size.height);
}

ps issue on github created 2 weeks ago, the developer did not answer

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
An, 2013-11-11
@deleted-mezhevikin

Can you see the source code for this project?
At you after transition to a trace. screen the height of the frame'a of the table is increased by the height of the tapBar'a. It seems that during the reverse animation this height is not reset, and remains larger by the height of the tapBar.
Table, is it _contentView?
if so, then look at what
_isTabBarHidding is equal to
when performing reverse animation in the line
.size.height = CGRectGetHeight(self.bounds) - ((!_isTabBarHidding)? CGRectGetHeight(_tabBar.bounds): 0)
there is an assumption that _isTabBarHidding == YES ( although it should be NO).
If so, then most likely layoutSubview is called before you update _isTabBarHidding and you need to force setNeedsLayout to the base view after setting _isTabBarHidding == NO
But again, no source

G
gooddy, 2013-11-13
@gooddy


diff --git a/AKTabBarController/AKTabBarController.m b/AKTabBarController/AKTabBarController.m
index e8226ac..9853490 100755
--- a/AKTabBarController/AKTabBarController.m
+++ b/AKTabBarController/AKTabBarController.m
@@ -251,6 +251,9 @@ typedef enum {
     tabBar.hidden = NO;
     tabBar.transform = CGAffineTransformMakeTranslation(CGRectGetWidth(self.view.bounds) * directionVector, 0);
     // when the tabbarview is resized we can see the view behind
+	CGRect tmpTabBarView = tabBarView.contentView.frame;
+	tmpTabBarView.size.height = CGRectGetHeight(tabBarView.bounds) - CGRectGetHeight(tabBar.bounds);
+	tabBarView.contentView.frame = tmpTabBarView;
     
     [UIView animateWithDuration:((animated) ? kPushAnimationDuration : 0) animations:^{
         tabBar.transform = CGAffineTransformIdentity;

save it to the fix.patch file, go to the component's turnip and

git apply /path/to/fix.patch

or add by hand

G
gleb_kudr, 2013-11-11
@gleb_kudr

The problem is related to changing the position of the content relative to the screen in ios7. Previously, the content was under the navigation and above the tabbar, and the lower and upper offsets = 0 (the value by which the upper and lower values ​​of the scroll recede from the border of the control). In ios7, the content matches the screen size, and offsets are not equal to zero and are determined by a cunning and crooked mechanism that somehow works on native controls, but with custom ones you have to set them manually. In general, google "ios7 uitableview offset".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question