Closed HumidBrains closed 6 years ago
maybe your forget step 3 (For each UITabBarItem, set the class to RAMAnimatedTabBarItem.)
Unfortunately not. Everything is in place and as mentioned I know how to make it work on a single storyboard. You should also be able to reproduce the bug (if it is one) by setting it up so it works on a single storyboard, then refactor to multiple storyboards. For me it breaks every time.
You can make it work on multiple storyboards by refactor to multiple storyboards from the second view controller related to each tab item, but that's not what you want when organizing a larger app.
I set up a clean repo demonstrating how the crash occurs (link below). Roll back to the single storyboard version to see that all works and then when refactoring to multiple storyboards, it breaks. I would be very grateful for any help.
the problem is tabBar.items doesn't inherited from RAMAnimatedTabBarItem then use multiple storyboards screen maybe it storyboard bug
I'm able to replicate this as well.
@HumidBrains I just made my own class
class AnimatedTabBarController: UITabBarController {
override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
if let view = item.valueForKey("view") as? UIView, let image = view.subviews.first as? UIImageView {
//animating tab bar image
let expandTransform = CGAffineTransformMakeScale(1.2, 1.2);
image.transform = expandTransform
UIView.animateWithDuration(0.7,
delay:0.0,
usingSpringWithDamping:0.40,
initialSpringVelocity:0.1,
options: .CurveEaseOut,
animations: {
image.transform = CGAffineTransformInvert(expandTransform)
}, completion: nil)
}
}
}
You can of course incorporate your own animation...but this saved me a lot of time I would've spent debugging
I was seeing this same issue.
A workaround is to create a container view controller and embed your other view controller that can be in a separate Storyboard. You'll need to declare the custom tab bar item as well as the animation object in the container view controller.
I've created a repo and a detailed README for how to this here.
Thanks to @jeffaburt for the help looking into this!
I have got same issue. When I test it on real device from XCode it works fine. When I launch it from Crashlytics I found a crash in same method like in first comment.
Also same issue with #139 But I have got a crash on real-device.
I didn't check @jrmsklar solution yet. Try to solve it using another methods for now. Thanks.
All works great for me if all view controllers are on the same storyboard. However, when using multiple storyboards, I can't find a setup that works. However I do I get this error...
fatal error: items must inherit RAMAnimatedTabBarItem
Maybe someone else has experienced this problem and has a solution to this? Thanks.