-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
ChrisSchneider edited this page Jun 15, 2012
·
14 revisions
Here you can find basic examples on how you may use the controls.
For example you might declare a swipeSlider
property and two IB Action methods.
@property (strong, nonatomic) IBOutlet EKSwipeSlider *swipeSlider;
// IB Actions
- (IBAction)handleSwipeSliderDidChangeValue:(EKSwipeSlider * )sender;
- (IBAction)handleSwipeSliderWasTapped:(EKSwipeSlider * )sender;
- Add a
UIView
object to the view controller and change its class toEKSwipeSlider
. - Connect the
swipeSlider
property to theEKSwipeSlider
view. - Connect
handleSwipeSliderDidChangeValue
action to theEKSwipeSlider
and select Value Changed. - Optionally add a UILabel or UIImageView as a subview to the
EKSwipeSlider
.
- (void)viewDidLoad
{
[super viewDidLoad];
// Configure the appearance of the slider
self.swipeSlider.layer.cornerRadius = 6.0f;
self.swipeSlider.layer.borderColor = [UIColor colorWithWhite:0.7 alpha:1.0f].CGColor;
self.swipeSlider.layer.borderWidth = 1.0f;
// Configure the slider's values
self.swipeSlider.minimumValue = 5.0f;
self.swipeSlider.maximumValue = 20.0f;
self.swipeSlider.value = 12.0f;
// Manually add a target for the tap event
[self.swipeSlider addTarget:self action:@selector(handleSwipeSliderWasTapped:) forControlEvents:EKSwipeControlTapEvent];
}
- (void)viewDidUnload
{
[super viewDidUnload];
self.swipeSlider = nil;
}