gpt4 book ai didi

ios - 以编程方式设置 UIButton 文本颜色

转载 作者:搜寻专家 更新时间:2023-11-01 05:53:45 24 4
gpt4 key购买 nike

<分区>

我想更改 TableView 页脚中的按钮文本颜色。这是我正在使用但无法正常工作的代码

override func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let footerView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, 40))
footerView.backgroundColor = UIColor.blackColor()

let rgbValue = 0x4097d4
let color = Util.getColor(rgbValue)




let button = UIButton(type: UIButtonType.System) as UIButton
button.frame = CGRectMake(0, 0, 414, 65)

button.setTitle("my Button", forState: UIControlState.Normal)
button.titleLabel?.textColor = UIColor.whiteColor()
button.titleLabel?.font = UIFont(name: "Montserrat-Regular", size: 20.0)



button.backgroundColor = UIColor( red: CGFloat(color[0]), green: CGFloat(color[1]), blue:CGFloat(color[2]), alpha: 1.0 )



footerView.addSubview(button)


return footerView
}

override func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 40.0
}

一个问题是文本颜色没有改变,另一个问题是我的表格 View 中有很多静态行。我正在修复底部的按钮,但问题是当屏幕到达末尾时,如果我单击屏幕并将屏幕拖动到上方,按钮后仍然会显示一些空白

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com