Ramotion / animated-tab-bar

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
https://www.ramotion.com/animated-tab-bar-ios-app-development-ui-library/
MIT License
11.12k stars 1.33k forks source link

Badge position #33

Closed benjaminhorner closed 8 years ago

benjaminhorner commented 9 years ago

I tried adding a badge to the RAMAnimatedTabBarItem and it is offset. Instead of sticking to the right it sticks to the left. Furthermore, it appears BEHIND the icon.

nassarofficial commented 9 years ago

same issue here...

benjaminhorner commented 9 years ago

It appears Apple uses the UIImage to position the badge. But in the case of a RAMAnimatedTabBarItem, the UIImage is replaced with a UIView. Therefore, the badge positions itself to the left. You can see this by adding a badge to a TabBarItem with no image.

As for the badge being behind, I guess that comes simple from the fact the UIView that comes in replacement of the UIImage is not sent to the back of the stack.

I found a rather nice way of getting around this issue using your own UILabel for the badge, and positioning it yourself. Maybe this could be added as default behavior to the RAMAnimatedTabBar ?

GuyKahlon commented 8 years ago

Hi @benjaminhorner, can you share your code please?

0ber commented 8 years ago

I fixed badge in version 1.0.5