問題タブ [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.
ios - UIViewを使用したSwiftUIボタン
と呼ばれるカスタム UIButton クラスから SwiftUI ボタンを作成していますUIPillButton
。以下は、SwiftUI ボタンを作成するためのコードです。
PillButton
カスタム UIButton を変換する SwiftUI ビューを作成するためのクラスを次に示します。
問題は、ボタンPillButton
自体をタップすると、ボタンがアクションを実行していないことです。上のバッファ(パディング)スペースを選択した場合にのみ機能しますPillButton
。PillButton
カスタムクラスを通常のSwiftUIボタンとして使用できるようにするにはどうすればよいですか?