我正在尝试设计带有呼叫按钮的导航栏。但是,标准导航栏在滚动时从大到内联,这使得呼叫按钮不再适合导航栏?滚动时有没有办法阻止导航栏切换?还是有一种特定的方法可以在滚动时将按钮保留在导航栏上?任何帮助将不胜感激!谢谢!
这就是我目前正在使用的东西!
.navigationBarTitle("Elevate", displayMode: .large)
.navigationBarItems(trailing:
HStack
{
Button(action: {
if let url = NSURL(string: "tel://\(1234567890)"), UIApplication.shared.canOpenURL(url as URL) {
UIApplication.shared.openURL(url as URL)
}
print("Edit button was tapped")})
{
Image(systemName: "phone.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30)
.padding(.top)
.accentColor(.black)
}
Button(action: {
print("Message button was tapped")})
{
Image(systemName: "message.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30)
.padding(.top)
.accentColor(.black)
}
Button(action: {
print("Settings button was tapped")})
{
Image(systemName: "gearshape.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30)
.padding(.top)
.accentColor(.black)
}
})