All Products
Search
Document Center

Check box control

Last Updated: May 25, 2021

AUCheckBox is a radio button control.AUCheckBox is migrated from the APCheckbox of APCommonUI. Use AUCheckBox instead of APCheckbox.

Sample image

AUCheckBox

API description

 
  1. /**
  2. The check box type.
  3. - AUCheckBoxStyleDefault: The default style, similar to the check box of the web.
  4. - AUCheckBoxStyleCheckmark: The checkmark style of tableview.
  5. */
  6. typedef NS_ENUM(NSInteger, AUCheckBoxStyle) {
  7. AUCheckBoxStyleDefault,
  8. AUCheckBoxStyleCheckmark
  9. };
  10. /**
  11. The radio button control.
  12. */
  13. @interface AUCheckBox : UIControl
  14. /**
  15. Initialize the AUCheckBox method according to the type.
  16. @param style The type of the check box.
  17. @return AUCheckBox
  18. */
  19. - (instancetype)initWithStyle:(AUCheckBoxStyle)style;
  20. /**
  21. Whether to select a property.
  22. */
  23. @property(nonatomic, assign, getter = isChecked) BOOL checked;
  24. /**
  25. Whether to disable a property.
  26. */
  27. @property(nonatomic, assign, getter = isDisabled) BOOL disabled;
  28. /**
  29. The check box type (read-only, set only upon initialization).
  30. */
  31. @property (nonatomic, assign, readonly) AUCheckBoxStyle style;
  32. @end

Sample code

 
  1. AUCheckBox *checkbox = [[AUCheckBox alloc] initWithStyle:AUCheckBoxStyleDefault];
  2. checkbox.checked = YES;
  3. checkbox.disabled = NO;
  4. checkbox.origin = CGPointMake(100, 250);
  5. [checkbox addTarget:self action:@selector(checkboxValueChanged:) forControlEvents:UIControlEventValueChanged];
  6. [self.view addSubview:checkbox];
  7. - (void)checkboxValueChanged:(id)sender
  8. {
  9. AUCheckBox *checkbox = (AUCheckBox *)sender;
  10. NSLog(@"%@", checkbox);
  11. }