Post

Replies

Boosts

Views

Activity

Custom Label doesn't work (MenuPickerStyle)
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())     } }
1
0
842
Sep ’22
Menu Picker gets pushed up by keyboard safeArea
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) } }
0
0
401
Sep ’22
memory leak help
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.
0
0
597
May ’21