問題タブ [uiviewrepresentable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
2589 参照

ios - UIViewを使用したSwiftUIボタン

と呼ばれるカスタム UIButton クラスから SwiftUI ボタン​​を作成していますUIPillButton。以下は、SwiftUI ボタン​​を作成するためのコードです。

PillButtonカスタム UIButton を変換する SwiftUI ビューを作成するためのクラスを次に示します。

問題は、ボタンPillButton自体をタップすると、ボタンがアクションを実行していないことです。上のバッファ(パディング)スペースを選択した場合にのみ機能しますPillButtonPillButtonカスタムクラスを通常のSwiftUIボタンとして使用できるようにするにはどうすればよいですか?

スクリーンショット