In SwiftUI, How do I increase the height of a button?

前端 未结 4 847
青春惊慌失措
青春惊慌失措 2020-12-06 11:01

As you can see in the screenshot, the button height does not adjust to fit the text size, making it look ugly. How can I increase the hight of the buttons, so it does not lo

4条回答
  •  Happy的楠姐
    2020-12-06 11:40

    Please try below Code:

    Button(action: {
           //do action       
    }) {
        Text("SIGN IN")
            .frame(width: 200 , height: 50, alignment: .center)
            //You need to change height & width as per your requirement
    }
     .background(Color.blue)
     .foregroundColor(Color.white)
     .cornerRadius(5)
    

    Output

提交回复
热议问题