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.13k stars 1.33k forks source link

Raising center tab bar icon #106

Closed dylanreich closed 8 years ago

dylanreich commented 8 years ago

Hi, I can't seem to figure out to have a raised center tab bar item icon such as in the mockup. What do I need to do? The only method I know of involves placing a UIButton over the tab bar item, but then I wouldn't get the animation that occurs when you click on an item. Thanks.

esthor commented 8 years ago

+1 -- I am also wondering this.

manuelCarlos commented 8 years ago

@dylanreich @esthor The private method createCustomIcons(containers : NSDictionary) of the RAMAnimatedTabBarController class adds the icons and its constraints to the tab bar. If you change the yOffset parameter in the call createConstraints(icon, container: container, size: itemImage.size, yOffset: -5) (this is around line 297) to, for example, createConstraints(icon, container: container, size: itemImage.size, yOffset: -15) all icons will be raised 10 points because the call is inside a for loop that sets up ALL the tab bar icons. You can do a check inside this for loop for the item you want to raise and apply the change to it only. Hope this helps :)

0ber commented 8 years ago

use @IBInspectable public var yOffSet: CGFloat = 0