Skip to content
ChrisSchneider edited this page Jun 15, 2012 · 14 revisions

Here you can find basic examples on how you may use the controls.

Swipe Slider


Interface

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;

Interface Builder

  1. Add a UIView object to the view controller and change its class to EKSwipeSlider.
  2. Connect the swipeSlider property to the EKSwipeSlider view.
  3. Connect handleSwipeSliderDidChangeValue action to the EKSwipeSlider and select Value Changed.
  4. Optionally add a UILabel or UIImageView as a subview to the EKSwipeSlider.

Implementation

- (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;
}
Clone this wiki locally