BCTabBarController icon indicating copy to clipboard operation
BCTabBarController copied to clipboard

hidesBottomBarWhenPushed is invalid

Open scorpiozj opened this issue 13 years ago • 10 comments

If one tab bar uses navigationController, the self.hidesBottomBarWhenPushed is invalid when I push a new view controller. In fact I need to hide the tab bar when I push a new view controller.

scorpiozj avatar Jun 21 '11 02:06 scorpiozj

hello, I have the same problem, do you have some suggest? thanks

wwwangxuefei avatar Jul 05 '11 05:07 wwwangxuefei

I use the UItabBar of UIKit

scorpiozj avatar Jul 06 '11 00:07 scorpiozj

This controller currently doesn't support hidesBottomBarWhenPushed. If someone could write a patch implementing this I would appreciate it. It is difficult because you need to :

  1. Observe UINavigationController for pushed viewControllers (could be done with KVO)
  2. Check that the pushed view controller has the hidesBottomBarWhenPushed property
  3. Resize the pushed viewController's view on the fly. I'm not sure this is possible, since the view is contained within the UINavigationController's view. I think navigation controllers interact with UITabBarControllers to arrange the resizing, something we don't have the luxury of doing without using private APIs.
  4. Keep the root viewController the same size (so presumably we can't resize the navigation controller's view)

Maybe I will have another shot at this but there is no easy solution.

briancollins avatar Sep 06 '11 16:09 briancollins

It's implemented in fork of the project. It seems it's not difficult. See this commit https://github.com/xuzhe/BCTabBarController/commit/467ae076a8eab96f9702a6ddd00fa6f9ecf84f4b I tried to make the same in my customization and it worked

zaplitny avatar Sep 11 '11 10:09 zaplitny

There are a couple of things wrong with that implementation.

It makes itself the delegate of every UINavigationController added to the tab bar. This is not ideal because some applications who are switching to this tab bar may already make use the delegate on their UINavigationController. It would be better to use NSNotificationCenter or KVO.

Secondly, the animation looks wrong. There is a black bar which appears as the view shifts when a new view controller is pushed. An ideal implementation would not have this.

Feel free to cherry-pick that commit or use that branch though.

On 11 September 2011 11:49, Sergei Zaplitny [email protected] wrote:

It's implemented in fork of the project. It seems it's not difficult. See this commit https://github.com/xuzhe/BCTabBarController/commit/467ae076a8eab96f9702a6ddd00fa6f9ecf84f4b I tried to make the same in my customization and it worked

Reply to this email directly or view it on GitHub: https://github.com/briancollins/BCTabBarController/issues/6#issuecomment-2063312

briancollins avatar Sep 11 '11 11:09 briancollins

Later commits make animation correct

zaplitny avatar Sep 11 '11 11:09 zaplitny

Which ones?

On 11 September 2011 12:36, Sergei Zaplitny [email protected] wrote:

Later commits make animation correct

Reply to this email directly or view it on GitHub: https://github.com/briancollins/BCTabBarController/issues/6#issuecomment-2063443

briancollins avatar Sep 11 '11 11:09 briancollins

This 5a7e411ec7c286884ca1d887eae42effbefa9faa

I agree, it's not the best solution but it works and it can be useful for many people

zaplitny avatar Sep 11 '11 11:09 zaplitny

That commit does not address the problem of the black bar as the view shifts, it just changes the animation of the tabBar disappearing and appearing.

On 11 September 2011 12:40, Sergei Zaplitny [email protected] wrote:

5a7e411ec7c286884ca1d887eae42effbefa9faa

Reply to this email directly or view it on GitHub: https://github.com/briancollins/BCTabBarController/issues/6#issuecomment-2063456

briancollins avatar Sep 11 '11 11:09 briancollins

Hmm I agree people would find it useful. I want to avoid a broken implementation though. I don't know whether to include this yet.

briancollins avatar Sep 11 '11 11:09 briancollins