             v.removeTarget(self, action: #selector(handleTabBarButton(button:)), for: .touchUpInside)
             v.addTarget(self, action: #selector(handleTabBarButton(button:)), for: .touchUpInside)
         }
-        
-        tb.select(at: selectedIndex)
     }
     
     fileprivate func prepareTabBar() {
         guard 0 < viewControllers.count else {
+            tabBar = nil
             return
         }
         

     - Parameter position: An Int for the position of the view controller.
     */
    fileprivate func layoutViewController(at index: Int, position: Int) {
        let vc = viewControllers[index]
        vc.view.frame = CGRect(x: CGFloat(position) * scrollView.width, y: 0, width: scrollView.width, height: scrollView.height)
    }
}

extension TabMenuController {
    /**
     Removes the view controller as a child view controller with
     the given index.
     - Parameter at index: An Int for the view controller position.
     */
    fileprivate func removeViewController(at index: Int) {
        removeViewController(viewController: viewControllers[index])
    }
    
    /**

            }
        } else if viewControllers.count - 1 == selectedIndex {
            for i in 0..<count {
                layoutViewController(at: selectedIndex - i, position: count - i - 1)
            }
        } else {
            layoutViewController(at: selectedIndex, position: 1)
            layoutViewController(at: selectedIndex - 1, position: 0)
            layoutViewController(at: selectedIndex + 1, position: 2)
            scrollView.setContentOffset(CGPoint(x: scrollView.width, y: 0), animated: false)
        }
    }
    
