iOSアプリケーションのオブジェクトライブラリにチェックボックスコントロールがありますか?私が見ている最も近いものは、ブール値を取ることができるスイッチコントロールです。iOSアプリケーションのチェックボックスコントロール
答えて
あなたはUIButtonの選択状態を使用することができ、(コード、またはInterface Builderを経由して)貴様のために異なる画像(またはもテキスト)を設定します。
[button setImage:[UIImage imageNamed:@"selected.png"]
forState:UIControlStateSelected];
[button setImage:[UIImage imageNamed:@"unselected.png"]
forState:UIControlStateNormal];
と最大アクション内部タッチで:
- (IBAction)buttonTouched:(id)sender
{
button.selected = !button.selected;
// add other logic
}
私にとって非常に便利です。ありがとう..... – Vaquita
これは、実装を提供するオープンソースライブラリです。 https://github.com/t4ku/RadioButtonWithUIKit –
動作しません。あなたはUIImageViewを取る必要があります。 –
これは、画面上の2つのチェックボックスに使用するコードです。私はUIControlEventTouchDownを使用してcheckBoxTappedメソッドを呼び出します。このメソッドは、メインビューコントローラと会話して、答えが正しいか正しくないかを判断します。次にメインビューコントローラは、このビューをコールバックし、いずれかのチェックにブランクテキストボックスを変更するように指示:
またはX
// Put the Checkboxes on the screen
UIImage *checkBox = [UIImage imageNamed:@"Checkbox"];
self.checkBoxLeft = [UIButton buttonWithType:UIButtonTypeCustom];
[self.checkBoxLeft setImage:checkBox forState:UIControlStateNormal];
[self.checkBoxLeft setFrame:checkBoxFrameLeft];
[self.checkBoxLeft addTarget:self
action:@selector(checkBoxTapped:)
forControlEvents:UIControlEventTouchDown];
[self.checkBoxLeft setTitle:@"checkBoxLeft" forState:UIControlStateNormal];
self.checkBoxLeft.contentEdgeInsets = insets;
self.checkBoxLeft.showsTouchWhenHighlighted = NO; // Keeps it from turning gray
self.checkBoxRight = [UIButton buttonWithType:UIButtonTypeCustom];
[self.checkBoxRight setImage:checkBox forState:UIControlStateNormal];
[self.checkBoxRight setFrame:checkBoxFrameRight];
[self.checkBoxRight addTarget:self
action:@selector(checkBoxTapped:)
forControlEvents:UIControlEventTouchDown];
[self.checkBoxRight setTitle:@"checkBoxRight" forState:UIControlStateNormal];
self.checkBoxRight.contentEdgeInsets = insets;
self.checkBoxRight.showsTouchWhenHighlighted = NO; // Keeps it from turning gray
- (void)checkBoxTapped:(UIButton *)buttonPressed {
[[self delegate] checkBoxTapped:buttonPressed.currentTitle];
}
- (void)highlightCheckbox:(NSString *)checkboxToHighlight withHighlight:(NSString *)highlight {
if ([checkboxToHighlight isEqualToString:@"left"]){
[self.checkBoxLeft setImage:[UIImage imageNamed:highlight] forState:UIControlStateNormal];
} else {
[self.checkBoxRight setImage:[UIImage imageNamed:highlight] forState:UIControlStateNormal];
}
}
//ボタンのプロパティを定義
未確認のイメージを宣言
- (void)viewDidLoad
{
[_checkboxButton setBackgroundImage:[UIImage imageNamed:@"unchecked.png"] forState:UIControlStateNormal];
}
画像をチェック。
- (IBAction)buttonTapped:(id)sender
{
if (_checkboxButton.selected == YES)
{
[_checkboxButton setBackgroundImage:[UIImage imageNamed:@"unchecked.png"] forState:UIControlStateSelected];
_checkboxButton.selected = NO;
}
else
{
[_checkboxButton setBackgroundImage:[UIImage imageNamed:@"checked.png"] forState:UIControlStateNormal];
_checkboxButton.selected = YES;
}
}
- 1. チェックボックスコントロール
- 2. Jqueryチェックボックスコントロール
- 3. チェックボックスコントロールのasp.netトリガー
- 4. サブレコードページのチェックボックスコントロールの値を取得
- 5. チェックボックスコントロールのアニメーションの一時停止/防止
- 6. ASP.netコアでチェックボックスコントロールを行う方法
- 7. Infopath 2007:チェックボックスコントロールを非表示にする
- 8. iOSアプリケーションのダウンロード
- 9. iOS:アプリケーションのモデルアーキテクチャ
- 10. iosアプリケーションのjpeg2000
- 11. iOSアプリケーションのアプリケーションストレージサイズ
- 12. iOSアプリケーションのベストキャッシュサイズ
- 13. iOSアプリケーションのベンチマーク
- 14. アプリケーションのローカリゼーション(IOS)
- 15. のiOSアプリケーションは
- 16. iOSアプリケーションでのローカライゼーション
- 17. iOSアプリケーションでのエラーペイント
- 18. iosアプリケーションでのフラッシュエラー
- 19. IOSのアプリケーション設定
- 20. iOSアプリケーションのADBツール
- 21. iOSアプリケーションのiPad版
- 22. iOSアプリケーションのFirebaseプレゼンスシステム
- 23. のiOSアプリケーションはEXC_BAD_INSTRUCTION
- 24. iOS Simulatorアプリケーションのターミナルコマンドラインデバッグ?
- 25. vuforiaのタッチイベントiOSアプリケーション
- 26. シンプルなIOSアプリケーション
- 27. アプリケーションは、iOS
- 28. iOS Cordovaアプリケーション - shouldStartLoadWithRequest
- 29. アプリケーション開発(ios)
- 30. iOSアプリケーション用ファイルサーバー
UISegmentedControlがお役に立ちます – 0xDE4E15B
UIButton状態をチェック/チェックマークに使用します。チェックしない(通常の状態)とチェックする(選択した状態)の画像を入れてください。 – Hirak
いいえチェックボックスまたはラジオボタンのデフォルトのUIコントロールがありません。ここでは、チェックとチェックを外して論理的に2つの異なるイメージを使用してください。 – kulss