|
I have this code, modified from stuff posted elsewhere, for entering dates. It works pretty well, but the UITextField which displays the date chooses its own width and I haven't been able to work out how to modify it.
In my content view, I have
but no matter how I set the frame widths for the two Texts, I end up with Start -big gap- DateEntryView -small gap- End -big gap- DateEntryView which looks odd. The Spacer in the HStack seems to do nothing. I've tried putting a frame modifer on the DatEntryView; I've tried specifying an initialised CGRect instead of .zero in the super.init call; I've tried putting more Spacer()s at the beginning and end, but nothing seems to affect the layout. How can I get control over the spacing / size of the DateEntryView view? Any ideas gratefully received. Jeremy |
|
Strange. I just added this and the frame of the text field changed (as indicated by the blue boxes in the preview canvas).
You could also do this to have the frame made at its ideal size.
|
|
Thanks - but although the blue boxes do draw correctly, the spacing in the HStack seems to take no notice. |
|
I don't understand what you mean. Did you remove the I set the body property to this:
and this is the result: The |
|
That's curious - it's not what I see. I suspect there's something else in the VStack that's causing a problem. Thanks for the help, anyway. |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.