-
Notifications
You must be signed in to change notification settings - Fork 154
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
Enhanced PrettyTabBar #12
base: master
Are you sure you want to change the base?
Enhanced PrettyTabBar #12
Conversation
This uses an internal representation as well as reflecting it in the view hierarchy to allow more configurable tab bar buttons.
also corrected logic flow for selection of tabbarbuttons
…e obvious. setting of badge value does the correct things by copying as well as setting that a redraw is needed.
…nded rectangle corresponding methods to draw rounded rectangles with a solid fill color and with a gradient. abstracted gradient drawing into a method that will draw to a context you specify. also used a more primitive way of dealing with the colors UIColor additions to deal with getting of converted RGB components in the absence of colorspace conversion mechanics
also modified font style to match defat UITabBarButtons'
…ews and Controllers.
removed sending super observevalueforkeypath. technically not needed.
Done! I can't make badges work, though :/ |
Weird. I've gotten them to work by modifying the View Controller's UITabBarItem's badgeValue. PrettyTabBar listens for changes to those and changes the value accordingly. |
I've tried, before my changes, that way and also through the IB's field, and it didn't seem to work :/. I haven't tried hard, though. |
Weird. Works for me. Insert this at line 34 of the appdelegate: |
I did that from the view controller ( |
Ah! Okay. I think I know what to do for this. :) |
i just checked apple's implementation, it also doesn't seem to reflect the change in the badge value. Further investigation says that if you try to set the badgeValue during viewDidLoad, it doesn't seem to work. However anytime else after the UIViewController has loaded, calling self.tabBarItem.badgeValue = something should work fine and update the tabbar. |
Regarding #13: Translucent tabbars would only probably work if they are not part of the UITabBarController as the content view of the tabbar controller will not resize to encompass the area lost (a la translucent UINavigationBar). Don't really see a point beyond the fact that this might introduce bad UI design. Btw, added some more commits previously. Not sure if you've merged them. |
I've just merged them. |
Hi @echoz. Happy to see tabbar is still alive :D. Do you have any clue about the issue with predefined IB buttons? I mean this: #12 (comment). |
I can't give a definitive answer (because I haven't really had the time to look into it), but as of this moment I don't think its possible to use predefined buttons for this :/ |
Well, as a last resort we could add a note in documentation to explain that. |
Yeah. I guess that'll do for now. Will look into it when I have more time on my hands. |
This is a huge ass commit. Really sorry for the multiple commits. Should've rebased it first.
That aside, this pull request basically is about an enhanced UITabBar. It has the following features,
This new TabBar is should be a drop in replacement while supporting all callbacks that is expected of a UITabBar. Has been tested with UITabBarControllers to work perfectly. No changes needed to make this work with existing projects, just use PrettyTabBar instead of an UITabBar.
The new class PrettyTabBarButton itself provides more configuration than previously possible for normal UITabBars while still support iOS 4.3.
Some of the configurable options include,
While these options are configurable on the TabBarButton, they are really only settable via usage of the PrettyTabBar as there is tight coupling between both classes (also how Apple seems to do it).
PrettyTabBarButton draws everything using Core Graphics.
Also added some new methods to the PrettyDrawing class.