         }
         for (idx, item) in items.enumerated() {
             if idx == index {
-                item.setSelected(true, animated: animated)
-                delegate?.tabNavigationBar?(self, didSelectTitleItemAt: index)
+                delegate?.tabNavigationBar?(self, willSelectTitleItemAt: index)
+                item.setSelected(true, animated: animated) { [unowned self] in
+                    self.delegate?.tabNavigationBar?(self, didSelectTitleItemAt: index)
+                }
             } else {
                 item.setSelected(false, animated: animated)
             }


@objc
public protocol TabNavigationBarDelegate {
    @objc
    optional func tabNavigationBar(_ tabNavigationBar: TabNavigationBar, didSelectTitleItemAt index: Int) -> Void
    @objc

                _titleColorAnimation.property = POPAnimatableProperty.attributedButtonTextColor(for: _ns_range, state: .normal)
                _titleColorAnimation.toValue = _selectionTitleColors[selected]
                _titleColorAnimation.removedOnCompletion = true
                _titleColorAnimation.completionBlock = { animation, finished in
                    completion?()
                }
                self._button.pop_add(_titleColorAnimation, forKey: "ATTRIBUTEDCOLOR")
            } else {
                let _fontSizeAnimation = POPSpringAnimation()
