作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试设置一个导航按钮,使其显示为红色和半粗体。我设法更改了颜色,但在将其更改为半粗体时遇到了问题:
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Sign Up", style: .plain, target: self, action: #selector(signIn))
navigationItem.rightBarButtonItem?.tintColor = .red
UIBarItem.appearance().setTitleTextAttributes(
[
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 12, weight: .semibold)
],
for: .normal)
我首先尝试了 rightBarButtonItem.appearance 但这似乎不是一个选项。
我正在使用 Swift 4.2。
最佳答案
您可以将 style
属性设置为 .done
以使 UIBarButtonItem
粗体。这将一直有效,直到 Apple 更改完成按钮在较新版本的 iOS 中的外观。
navigationItem.rightBarButtonItem?.style = .done
关于swift - 将 rightBarButtonItem 设为粗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58346376/
由“CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", ES_MULTILINE.."创建的文本框需要\r\n 换行。我将我的 stdoutput 重定向到那个文
我是一名优秀的程序员,十分优秀!