首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >xlpagertabstrip某些标签未完全显示

xlpagertabstrip某些标签未完全显示
EN

Stack Overflow用户
提问于 2018-10-08 16:04:04
回答 1查看 341关注 0票数 0

我在我的应用程序中使用XLpagertabstrip。但是我有一个问题,文字比宽度大,而且从两边都被剪掉了。如下图所示:

如您所见,最后一个选项卡المواجهاتالمباشرة未完全显示。

这是我的代码:

代码语言:javascript
复制
override func viewDidLoad() {
    super.viewDidLoad()

    containerView.isScrollEnabled = false
    containerView.delegate = self

    self.settings.style.buttonBarBackgroundColor = UIColor.clear
    self.settings.style.buttonBarItemBackgroundColor = UIColor.clear
    self.settings.style.selectedBarBackgroundColor = UIColor.clear
    self.settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 7)
    self.settings.style.selectedBarHeight = 1.0
    self.settings.style.buttonBarMinimumLineSpacing = 0.1
    self.settings.style.buttonBarItemTitleColor = UIColor.white
    self.settings.style.buttonBarItemsShouldFillAvailableWidth = true
    self.settings.style.buttonBarLeftContentInset = 0
    self.settings.style.buttonBarRightContentInset = 0
    self.settings.style.selectedBarHeight = 1.0

    changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        //oldCell?.label.adjustsFontSizeToFitWidth = true
        //newCell?.label.adjustsFontSizeToFitWidth = true
        oldCell?.label.textColor = UIColor.white
        newCell?.label.textColor = UIColor.white
        oldCell?.label.font = UIFont(name: "AJannatLT", size: 14)!
        newCell?.label.font = UIFont(name: "AJannatLT", size: 14)
        newCell?.label.lineBreakMode = .byCharWrapping
        oldCell?.label.lineBreakMode = .byCharWrapping
        self?.buttonBarView.selectedBar.backgroundColor = UIColor.white
    }

    getMatchInfo()

    self.navigationController?.navigationBar.topItem?.title = " "

    // Do any additional setup after loading the view.
}

但这只会改变它的字体大小,如果我用tabbed键的话...

如何解决这个问题?我希望它从一开始就完全显示并适合单元格的宽度。

EN

回答 1

Stack Overflow用户

发布于 2018-10-08 16:25:11

但是我有一个问题,文本比宽度大,而且从两边都被剪掉了

你可以试试lineBreakMode

代码语言:javascript
复制
label.lineBreakMode = .ByCharWrapping

阅读有关LineBreakMode的更多信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52697877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档