[英]How to create Subtitle or Smaller Title under the Large title in Swift
I want to create aa title page that look similarly like on the Health App.我想创建一个类似于 Health App 的标题页。 It has Large title 'Summary' and a smaller title 'Favorites'
它有一个大标题“摘要”和一个小标题“收藏夹”
I'm able to create the Large title by Prefers Large Title.我可以通过 Prefers Large Title 来创建大标题。 But how do I create the smaller title like 'Favorites' in Health app?
但是如何在健康应用程序中创建较小的标题,例如“收藏夹”?
Here's a look at my app:这是我的应用程序:
UPDATE:更新:
With the help of my friends here, I was able to create the header view closer to my expectation, but it needs a bit modification.在我朋友的帮助下,我能够创建更接近我预期的 header 视图,但需要进行一些修改。 Here's what it looks like now:
这是它现在的样子:
Add a custom viewForHeader
for your UITableView
.为您的
UITableView
viewForHeader
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let label = UILabel()
label.text = "Small title"
label.font = .boldSystemFont(ofSize: 32) // give your required value here
return label
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.