skip to Main Content

Related to this

Gif

I am trying to make an app based on Notes app.

I set my iPhone text size to the smallest, and when the view changes, the texts on new view’s toolbar gets bigger.

Code :

.toolbar {
        ToolbarItem(placement: .navigationBarTrailing) {
            HStack {
                Button {
                    parentList.starred.toggle()
                } label: {
                    Label("Toggle Favorite", systemImage: parentList.starred ? "star.fill" : "star")
                        .labelStyle(.iconOnly)
                        .foregroundColor(parentList.starred ? .yellow : .gray)
                }
                
                Button(action: editList) {
                    Label("Edit List", systemImage: "ellipsis.circle")
                }
                
                EditButton()
            }
        }
        
        ToolbarItem(placement: .bottomBar) {
            Spacer()
        }
        
        ToolbarItem(placement: .status) {
            if parentList.childvocabularies!.count == nil {
                Text("")
                    .foregroundColor(.secondary)
                    .font(.caption)
            }
            else if parentList.childvocabularies!.count == 1{
                Text("(parentList.childvocabularies!.count) Vocabulary")
                    .foregroundColor(.secondary)
                    .font(.caption)
            } else {
                Text("(parentList.childvocabularies!.count) Vocabularies")
                    .foregroundColor(.secondary)
                    .font(.caption)
            }
        }
        
        ToolbarItem(placement: .bottomBar) {
            Button(action: addItem) {
                Label("Add Item", systemImage: "plus")
            }
        }
    }

Is this a bug?

2

Answers


  1. Chosen as BEST ANSWER

    This bug is solved in iOS 16 beta.


  2. While this introduces other issues (like changing left padding), you can try:

    Text("ACCOUNT")
        .font(.boldFont(size: 14))
        .minimumScaleFactor(0.5)
        .fixedSize(horizontal: true, vertical: false)
    

    Minimum scale factor prevents the font size from increasing and fixed size prevents the text from being truncated. Bold font is our custom extension getting our custom font in bold.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search