briancollins / BCTabBarController

a Tweetie-style tab bar for the iPhone
MIT License
568 stars 95 forks source link

hidesBottomBarWhenPushed is invalid #6

Open scorpiozj opened 13 years ago

scorpiozj commented 13 years ago

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.

wwwangxuefei commented 13 years ago

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

scorpiozj commented 13 years ago

I use the UItabBar of UIKit

briancollins commented 13 years ago

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.

zaplitny commented 13 years ago

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

briancollins commented 13 years ago

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 reply@reply.github.com 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

zaplitny commented 13 years ago

Later commits make animation correct

briancollins commented 13 years ago

Which ones?

On 11 September 2011 12:36, Sergei Zaplitny reply@reply.github.com 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

zaplitny commented 13 years ago

This 5a7e411ec7c286884ca1d887eae42effbefa9faa

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

briancollins commented 13 years ago

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 reply@reply.github.com wrote:

5a7e411ec7c286884ca1d887eae42effbefa9faa

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

briancollins commented 13 years ago

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.