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

EXC_BAD_INSTRUCTION when using programatically #3

Closed ctews closed 9 years ago

ctews commented 9 years ago

Hey guys,

I'm not using storyboard or any nib files to build up my view - just doing it manually. To give you a short overview:

I've a custom class which inherits from RAMAnimatedTabBarController. In the viewDidLoad of my custom class I call super.viewDidLoad which calls the one of RAMAnimatedTabBarController.

Then I got the described error in line:157:

func createViewContainers() -> NSDictionary {
    // ...
    let itemsCount : Int = tabBar.items!.count as Int - 1
    // ...
}

tabBar.items is by default nil, at least the public api says it:

var items: [AnyObject]? // get/set visible UITabBarItems. default is nil. changes not animated. shown in order

So I guess here is the problem. Would be nice if you can give a hint on how to implement your controller manually. I followed the steps you show up and exchanged all UITabBar* classes with the ones you declared and set the animation but as said it crashes on the viewDidLoad of the RAMAnimatedTabBarController.

ctews commented 9 years ago

Ok sorry, my code was just dumb -.-

y0dev commented 8 years ago

@ctews Can you give me a hint on trying to figure it out. I'm having the same problem