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

Can't Move Bar Items Using Image Insets #94

Closed sentiasa closed 8 years ago

sentiasa commented 8 years ago

Whatever I change the insets, the image doesn't get any offset. Is it only me having this problem?

screen shot 2016-04-08 at 04 53 41

What should I do if I have for example 2 rotation & 1 bounce (in order - rotation-bounce-rotat). I want to offset the middle one above and offset the rotation ones below a little. Is there a way or workaround for that?


I also tried using this (in AppDelegate) but doesn't change it.

            let midBtn = ramTBC.tabBar.items![1]
            midBtn.imageInsets = UIEdgeInsetsMake(5,0,-5,0)

Is there a workaround for that issue?

sentiasa commented 8 years ago

I found the way for vertical movements (y-offSet), but still looking for an answer for x-Offset.. Digging in the library, I realised that inside createCustomIcons method in RAMAnimatedTabBarController, createConstraints(icon, container: container, size: itemImage.size, yOffset: -5) helps yOffset. And I can wrap it in an if condition (index number indicates the tab number so you can give a different yOffset for different tab icons)

However, I still couldn't manage to move icons to left & right; how can I achieve the xOffset kind of approach for icons?


Update: The answer lies inside createConstraints method. I added xOffset as a parameter inside the method, and for let constX, I changed constant: 0 to constant: xOffset.