VLCSlider.m 1.87 KB
Newer Older
Felix Paul Kühne's avatar
Felix Paul Kühne committed
1 2 3 4 5 6 7
//
//  VLCSlider.m
//  VLC for iOS
//
//  Created by Felix Paul Kühne on 06.06.13.
//  Copyright (c) 2013 VideoLAN. All rights reserved.
//
8 9
//  Refer to the COPYING file of the official project for license.
//
Felix Paul Kühne's avatar
Felix Paul Kühne committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

#import "VLCSlider.h"

@implementation VLCOBSlider

- (void)awakeFromNib
{
    self.minimumValueImage = [UIImage imageNamed:@"sliderminiValue"];
    self.maximumValueImage = [UIImage imageNamed:@"slidermaxValue"];
    [self setMinimumTrackImage:[UIImage imageNamed:@"sliderminimumTrack"] forState:UIControlStateNormal];
    [self setMaximumTrackImage:[UIImage imageNamed:@"slidermaximumTrack"] forState:UIControlStateNormal];
    [self setThumbImage:[UIImage imageNamed:@"ballSlider"] forState:UIControlStateNormal];
    [self setThumbImage:[UIImage imageNamed:@"knobSlider"] forState:UIControlStateHighlighted];
}

- (CGRect)trackRectForBounds:(CGRect)bounds
{
    CGRect returnValue = [super trackRectForBounds:bounds];
    returnValue.origin.x = 5.;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
29
    if (!SYSTEM_RUNS_IOS7_OR_LATER)
30
        returnValue.origin.y = 7.;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    returnValue.size.width = bounds.size.width - 10.;
    return returnValue;
}

@end


@implementation VLCSlider

- (void)awakeFromNib
{
    self.minimumValueImage = [UIImage imageNamed:@"sliderminiValue"];
    self.maximumValueImage = [UIImage imageNamed:@"slidermaxValue"];
    [self setMinimumTrackImage:[UIImage imageNamed:@"sliderminimumTrack"] forState:UIControlStateNormal];
    [self setMaximumTrackImage:[UIImage imageNamed:@"slidermaximumTrack"] forState:UIControlStateNormal];
    [self setThumbImage:[UIImage imageNamed:@"ballSlider"] forState:UIControlStateNormal];
}

- (CGRect)trackRectForBounds:(CGRect)bounds
{
    CGRect returnValue = [super trackRectForBounds:bounds];
    returnValue.origin.x = 5.;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
53
    if (!SYSTEM_RUNS_IOS7_OR_LATER)
54
        returnValue.origin.y = 7.;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
55 56 57 58 59
    returnValue.size.width = bounds.size.width - 10.;
    return returnValue;
}

@end