Why is there no custom label displayed?
Thanks for an answer.
struct ContentView: View{
@State var selection = 0
let numbers = [1,2,3,4,5]
var body: some View{
Picker(selection: $selection, content: {
ForEach(numbers,id:\.self){i in
Text("Number \(i)").tag(i)
}
}, label: {
Text("\(selection)")
.padding()
.background(Circle().foregroundColor(.red))
})
.pickerStyle(MenuPickerStyle())
}
}
Post
Replies
Boosts
Views
Activity
Although having a .ignoresSafeArea modifier attached, the button for the menu gets pushed up a little bit. I don't know why. When using a regular picker with .pickerStyle(MenuPickerStyle()) I can't get a custom label.
Thanks for an answer
import SwiftUI
struct ContentView: View {
@State var text = ""
@State var selection = ""
let foo = ["a","b","c"]
@FocusState var focus
var body: some View{
GeometryReader{_ in
ZStack{
Color(UIColor.systemGray6)
ScrollView{
VStack{
TextField("title", text: $text)
.focused($focus)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.border(.orange)
Spacer()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
overlayInZStack // <-------- here is the overlay
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.ignoresSafeArea(.keyboard, edges: .bottom) // <------ modifier attached
}
var overlayInZStack: some View {
VStack{
Spacer()
HStack{
Button("focus"){
focus = true
}
Menu(content:{ // <----- menu picker in bottom tool row
Picker(selection: $selection, label:
EmptyView()
, content: {
ForEach(foo,id:\.self){f in
Label(f, systemImage: "house")
.tag(f)
}
})
Picker(selection: $selection, label:
EmptyView()
, content: {
Label("test", systemImage: "plus.circle.fill")
.tag("test 1")
})
},label:{
Image(systemName: "house")
.padding(10)
.background(Circle().foregroundColor(.red))
.border(Color.red)
})
.border(Color.orange)
}
.border(Color.green)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.border(Color.black)
}
}
I need help. I have a SpriteKit Scene and use the update function for changing a property of the Scene. This property is used for a Circle View in the ZStack. When I am tapping the Button, there is a memory leak detected in the leakage tool of Xcode. Is this a bug or why could this happen? The button only is printing something on the console.
import SpriteKit
}
}
The Leak is: NSXPCConnection remoteObjectProxyWithErrorHandler
If I change the button to: }
then there is appearing this library between the QuartzCore in the Malloc 64 Byte entry:
"AXCoreUtilities"
I really hope that there is anybody who knows what's going on here. Thanks for any answers.