0

I want to create a a title page that look similarly like on the Health App. It has Large title 'Summary' and a smaller title 'Favorites'

Health app

I'm able to create the Large title by Prefers Large Title. But how do I create the smaller title like 'Favorites' in Health app?

Here's a look at my app :

enter image description here

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. Here's what it looks like now :New updated

Aldo Sugiarto
  • 197
  • 3
  • 20

2 Answers2

1

Add a custom viewForHeader for your UITableView.

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
}
Frankenstein
  • 15,732
  • 4
  • 22
  • 47
  • Hey man can you check my updated post? It works but it needs a slight tweak with the header view. Can I make the curve of the table starts on the first row of the cell instead of the Title? Just like the Health App, the 'Favorites' title does not curve within the cell. Can you help me with this? – Aldo Sugiarto Jun 26 '20 at 18:19
  • 1
    If the original question was answered (Text size) and you have further questions that have nothing to do with the original question, you should create a new question. – Simon Jun 26 '20 at 19:42
0

This should work: Tested on iOS 13.5 (SwiftUI)

struct ContentView: View {
    
    var body: some View {
        VStack(){
            Text("Huge").font(.largeTitle)
            Text("Large").font(.title)
        }
    }
}

enter image description here

In the example you gave they also most likely had the modifier .bold()

koen
  • 5,383
  • 7
  • 50
  • 89
Simon
  • 1,754
  • 14
  • 32