0

我想我已经上下搜索了文档和示例代码。诚然,这意味着我错过了一些明显的东西。

当我实现 Eureka 时......我所有的标题都是系统字体,相当大,大小写,并被省略号修剪。

在包含的示例项目中:尺寸、外壳、颜色和包装都不同。我已经在完整的代码库中搜索了“lineBreakMode”“UIFont”和其他此类关键字。我已经检查了奇怪的类或小部件的故事板。同样,没有什么突出的。

由于我的标题目前看起来真的很差,因此对此的任何指示都将不胜感激。

谢谢!

4

1 回答 1

1

我使用 Eureka 示例应用程序来执行此操作:

为表头创建一个 UIView 类,给 UIView 添加标签,根据需要配置标签。看这里 :

class NewLabelView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.frame = CGRect(x: 10, y: 0, width: 320, height: 50)
        let label = UILabel(frame: self.frame)
        // setup the label as you wish here
        label.text = "My New Label" // label name
        label.font = UIFont(name: "Arial", size: 18) // Font
        label.textColor = UIColor.blackColor() // label textColor
        label.textAlignment = NSTextAlignment.Left // label Alignment
        // end label setup
        self.addSubview(label)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

最后你在你的部分实现它是这样的:

Section() {
$0.header = HeaderFooterView<NewLabelView>(HeaderFooterProvider.Class)
}

之后,您修改框架以使其看起来如您所愿!

于 2016-05-18T13:01:07.020 回答