Skip to content
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

Crashes when used with multiple storyboards. #93

Closed
HumidBrains opened this issue Apr 7, 2016 · 8 comments
Closed

Crashes when used with multiple storyboards. #93

HumidBrains opened this issue Apr 7, 2016 · 8 comments
Labels

Comments

@HumidBrains
Copy link

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.

@0ber
Copy link
Contributor

0ber commented Apr 8, 2016

maybe your forget step 3 (For each UITabBarItem, set the class to RAMAnimatedTabBarItem.)

@HumidBrains
Copy link
Author

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.

@HumidBrains
Copy link
Author

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.

https://github.com/HumidBrains/BrokenRAMAnimatedTabBar.git

@0ber
Copy link
Contributor

0ber commented Apr 8, 2016

the problem is tabBar.items doesn't inherited from RAMAnimatedTabBarItem then use multiple storyboards screen
maybe it storyboard bug

@0ber 0ber added the bug label Jun 15, 2016
@michael-mckenna
Copy link

I'm able to replicate this as well.

@michael-mckenna
Copy link

@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

@jrmsklar
Copy link

jrmsklar commented Aug 23, 2016

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!

@IlyaBaudin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants