             btn.tag = i
             btn.setTitle(titles[i], for: .normal)
             btn.setTitleColor(titleNomalColor, for: .normal)
-            btn.titleLabel?.font = UIFont.systemFont(ofSize: titleFontSize)
+            btn.titleLabel?.font = titleFont
             btn.titleLabel?.textAlignment = .center
             btn.backgroundColor = titleBackgroundColor
             btn.addTarget(self, action: #selector(btnClick), for: .touchUpInside)

        topScrollView.addSubview(slideView)
        
        if sliderStyle == .center {
            let attr = [NSAttributedStringKey.font: UIFont.systemFont(ofSize: titleFontSize)]
            let rect = titles[0].size(withAttributes: attr)
            let x = (width - rect.width) * 0.5
            let v = UIView(frame: CGRect(x: x, y: 0, width: rect.width, height: slideHeight))

    }
}

extension String {
    
    /// 根据字体计算尺寸
    func ss_size(withFont font: UIFont) -> CGSize {
        let attributes = [NSAttributedStringKey.font: font]
        return (self as NSString).size(withAttributes: attributes)
    }
}

