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

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.

Implementation

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // Configure the slider
    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