 
     open fileprivate(set) var titles = [NSAttributedString]() {
         didSet {
-            titleSizes = titles.map { sizeForAttributedString($0) }
+            updateTitleSizes()
         }
     }
     open fileprivate(set) var selectedTitles: [NSAttributedString]?

    open fileprivate(set) var selectedTitleAttachedIcons: [UIImage]?

    fileprivate var titleSizes = [CGSize]()

    open var isLongPressEnabled = false {
        didSet {


    open fileprivate(set) var selectedIndex = 0 {
        didSet {
            if selectedIndex != oldValue {
                updateTitleSizes()
            }
            setNeedsDisplay()
        }
    }
