You can use the WDCheckBoxView class to create and manage checkboxes.
(On the left the default customisation)
###Description This component is customisable and provide two animations:
- one for switching between checked/unchecked state
- one for highlight
There is a lot of room for appearance customisation using UI_APPEARANCE_SELECTOR
but, if you want more, you must play with Bezier paths category.
All animations can be disabled and you can resize it from 0 to infinite (auto layout support).
�When checked/unchecked state change an UIControlEventValueChanged
will be raised so you can track it.
###Note
This component has been made to learn something about layers and CoreAnimation.
I don't have pro skill with CA and I am pretty sure that a better way to do things always exists, but we must start with something.
#import "WDCheckBoxView.h"
- (void) viewDidLoad {
[super viewDidLoad];
WDCheckBoxView *checkboxView = [[WDCheckBoxView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)];
[self.view addSubview:checkboxView];
[checkboxView addTarget:self action:@selector(pressed:) forControlEvents:UIControlEventTouchUpInside];
}
- (void) pressed:(WDCheckBoxView *)sender{
[sender setChecked:!sender.checked animated:YES];
}
##Prerequisite WDCheckBoxView is compatible with ARC and use this frameworks:
- Foundation.framework
- UIKit.framework
- CoreGraphics.framework
- QuartzCore.framework
##Install
Simply download it from here and include it in your project manually.
You have the canonical git submodule
option. Simply issue
git submodule add https://github.com/daktales/WDCheckBoxView.git <path>
in your root folder of your repository.
This code is distributed under the terms and conditions of the MIT license.