SwiftUI_TextField_Part1

Created with Sketch.

SwiftUI_TextField_Part1

案件でSwiftUIをやる予定なので、少し調査をしています。

題名のSwiftUI_TextFieldの実装挙動で情報がない対応を公開します。

– 無い情報1

横並びの挙動がない。

– 無い情報2

アンダーラインの可変

挙動はこちらです。

横並びを実現する上で、このようにするとFieldのカーソルの位置が正しく保てました。

@State var spacing: CGFloat = 0
HStack(alignment: .bottom, spacing: spacing)

挙動の説明

HStackは横並びを成立させるブロックです。動作する度にTexField内に文字があるか判定して、文字がある場合は 下線を赤色にするプログラムをしています。文字がない場合は黒色です。

HorizontalLineShapeクラスの-rect.size.widthで下線位置を作成しています。

addRoundedRectは反時計回りになっているので、逆の-rect.size.widthでカーソル位置と下線位置を合わせました。

let fill = CGRect(x: -rect.size.width, y: 0, width: rect.size.width, height: rect.size.height)

VStackは縦のデザイン実装とbindを合わせているので、応用も効くかと思います。

以上、貴重なお時間お読み下さいまして、誠にありがとうございます。

13件の返信

  1. kiet giang より:

    There is certainly a lot to learn about this subject. I really like all the points you made.

  2. cumshots より:

    Aw, this was a really nice post. Taking the
    time and actual effort to produce a really good article… but
    what can I say… I hesitate a lot and never manage to get anything done.

  3. I’ve read several just right stuff here. Certainly price bookmarking for
    revisiting. I surprise how so much effort you put to
    make this kind of wonderful informative web site.

  4. cumshots より:

    That is very fascinating, You are an overly professional
    blogger. I’ve joined your feed and stay up for searching for more of your fantastic post.
    Additionally, I have shared your site in my social networks

  5. Jimmy より:

    Woah! I’m really loving the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between superb usability and visual appearance.
    I must say you have done a superb job with this. In addition, the blog loads
    super quick for me on Opera. Exceptional Blog! Wow, this post is pleasant, my younger sister is analyzing these things,
    therefore I am going to convey her. It is perfect time to make some plans for the future and it’s time to be happy.

    I’ve read this post and if I could I desire to suggest you few interesting
    things or suggestions. Perhaps you can write next articles referring to this article.
    I want to read even more things about it! http://ford.com

  6. I know this web site offers quality dependent articles and additional stuff, is
    there any other web site which offers such things in quality?

  7. cat hat より:

    I am always browsing online for tips that can benefit me.
    Thanks!

  8. cat hat より:

    I am sure this piece of writing has touched all the internet viewers, its really really fastidious article on building up
    new webpage.

  9. cat hat より:

    What i don’t understood is if truth be told how you are not really a lot more neatly-liked than you
    might be now. You’re so intelligent. You understand thus significantly in the case
    of this subject, made me for my part imagine it from numerous numerous angles.
    Its like men and women aren’t fascinated unless it’s something to accomplish with Woman gaga!
    Your personal stuffs outstanding. At all times handle it up!

  10. cat hat より:

    I am constantly searching online for ideas that can help me.
    Thanks!

  11. porn より:

    My coder is trying to convince me to move to .net
    from PHP. I have always disliked the idea because
    of the costs. But he’s tryiong none the less. I’ve been using
    Movable-type on numerous websites for about a year and am concerned about switching to another platform.
    I have heard great things about blogengine.net. Is there a way I can import all my wordpress posts into it?

    Any kind of help would be really appreciated!

  12. What’s up to every one, it’s actually a fastidious for me to pay a visit this site, it contains precious Information.

  13. Ugoevold より:

    [url=https://hydroxychloroquinesx.online/]plaquenil 800mg[/url] [url=https://ivermectinoral.online/]ivermectin price usa[/url] [url=https://viagrarb.online/]buy viagra online canada paypal[/url] [url=https://dexamethasone365.online/]dexamethasone 0.75[/url] [url=https://tadalafilr.online/]tadalafil generic cost[/url] [url=https://viagradpack.online/]viagra super active[/url] [url=https://fpspharmacy.online/]wholesale pharmacy[/url] [url=https://toptabstore.online/]hydroxychloroquine 40 mg[/url]

https://blog.ub.ac.id/furniture/ へ返信する コメントをキャンセル

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です