I have tried 4 methods above one by one:
Disabling "Connect Hardware Keyboard" seems only to affect the behavior of simulators, but not the canvas.
I switch to different simulators, include iPhone & iPad. But the problem is still there.
I add a new swiftui view and make it to have the simplest code. But it is still no go.
struct TextFieldPopupView: View { @State private var text = "" var body: some View { TextField("Hello", text: $text) .textFieldStyle(RoundedBorderTextFieldStyle()) } } struct TextFieldPopupView_Previews: PreviewProvider { static var previews: some View { TextFieldPopupView() } }
4. Removing derived data has no effect yet.
Thank you all the same.
Post
Replies
Boosts
Views
Activity
Great!!Inspired by your answers, I find that ".buttonStyle(BorderlessButtonStyle())" is the key point. If I apply it to Button view in my code above. The action block indeed works! But I can't get the reason. In addition, how could I prevent the onTapGesture block from working for Button? In other words, how could I make action block work only(mask the onTapGesture block )?
I’m afraid the flag only works when "the button action block" executes before "the onTapGesture block". However, as far as I know, the execution order seems to be random.:-(
Your first answer is important to me. Thanks a lot.
Thanks a lot
Thanks a lot :-)
The kind of "gesture" modifiers seems to have a higher priority than the action code within the picker. If we can decrease the priority, the problem should be solved.
@jeremy-dev
Thanks for your answer. :-) Is there any workaround for "Live Preview" in the Canvas in Xcode?
Thank you so much for your exhaustive answer.
I give up. Maybe the simulator is a better way for this case. :-)
I'm afraid I can't indicate the exact height of the long text needed.
The long text will be loaded dynamically and each row may need different height. The height is undetermined.
Thank you for your exhaustive reply :-)
This has provided me great insights. Thank you for your detailed reply!
Thank you very much. ".custom("Founders Grotesk Light", size: 30)" in your answer gives me a new insight. I thought there was an alignment problem with all custom fonts, but it seems to be with only a few fonts including my case "Arial Hebrew". How "lucky" I am!
It seems that only one approximate value can be given by "scaledPadding" approach. Maybe I should change to another font if an exact value cannot be evaluated.
Thank you for your reply! Is there any formula calculation method to evaluate the exact offset scale? -0.25 or -1/3 both seem to be ok by eye-measurement.