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. チェックボックスコントロールのasp.netトリガー
- 3. Infopath 2007:チェックボックスコントロールを非表示にする
- 4. iosアプリケーションのjpeg2000
- 5. iOSアプリケーションのアプリケーションストレージサイズ
- 6. iOSアプリケーションのベンチマーク
- 7. iOS:アプリケーションのモデルアーキテクチャ
- 8. iOSアプリケーションのベストキャッシュサイズ
- 9. iOSアプリケーションのダウンロード
- 10. IOSのアプリケーション設定
- 11. iosアプリケーションでのフラッシュエラー
- 12. iOSアプリケーションでのエラーペイント
- 13. iOS Simulatorアプリケーションのターミナルコマンドラインデバッグ?
- 14. iOSアプリケーション用ファイルサーバー
- 15. パッケージiOSアプリケーション
- 16. 親スタックパネルの子であるグループボックス内のチェックボックスコントロール
- 17. ASP.Net 2.0ポストバック時のチェックボックスコントロールの参照と操作
- 18. FacebookのiOSアプリケーションで無効なアプリケーションID
- 19. PhoneGapのIOSのアプリケーションのサイズ
- 20. 剣道UIの設定方法チェックボックスコントロール付きmvcグリッド
- 21. iosアプリケーションのテンプレートの種類
- 22. iOSアプリケーションでのシグネチャのキャプチャ
- 23. アプリケーション内のIOSアプリのアップデートチェック
- 24. iosアプリケーション提出クエリ
- 25. ティルト位置iOSアプリケーション
- 26. iOS simulateアプリケーションとログイベント
- 27. ウェブサイトとIOSアプリケーションのメンバーシップシステム
- 28. Xcode 4.2 iOS 4アプリケーションのテンプレート
- 29. iosへのポートmacアプリケーション
- 30. iosアプリケーションで複数のエンタイトルメント
UISegmentedControlがお役に立ちます – 0xDE4E15B
UIButton状態をチェック/チェックマークに使用します。チェックしない(通常の状態)とチェックする(選択した状態)の画像を入れてください。 – Hirak
いいえチェックボックスまたはラジオボタンのデフォルトのUIコントロールがありません。ここでは、チェックとチェックを外して論理的に2つの異なるイメージを使用してください。 – kulss