Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
805 | - | 1 | // |
2 | // PSToggleSwitchSpecifier.m |
||
3 | // InAppSettingsTestApp |
||
4 | // |
||
5 | // Created by David Keegan on 11/21/09. |
||
6 | // Copyright 2009 InScopeApps{+}. All rights reserved. |
||
7 | // |
||
8 | |||
9 | #import "InAppSettingsPSSliderSpecifierCell.h" |
||
10 | #import "InAppSettingsConstants.h" |
||
11 | |||
12 | @implementation InAppSettingsPSSliderSpecifierCell |
||
13 | |||
14 | @synthesize valueSlider; |
||
15 | |||
16 | - (void)slideAction{ |
||
17 | [self.setting setValue:[NSNumber numberWithFloat:[self.valueSlider value]]]; |
||
18 | } |
||
19 | |||
20 | - (void)setUIValues{ |
||
21 | [super setUIValues]; |
||
22 | |||
23 | //get the abolute path to the images |
||
24 | NSString *minImagePath = [InAppSettingsBundlePath stringByAppendingPathComponent:[self.setting valueForKey:@"MinimumValueImage"]]; |
||
25 | NSString *maxImagePath = [InAppSettingsBundlePath stringByAppendingPathComponent:[self.setting valueForKey:@"MaximumValueImage"]]; |
||
26 | |||
27 | //setup the slider |
||
28 | self.valueSlider.minimumValue = [[self.setting valueForKey:InAppSettingsSpecifierMinimumValue] floatValue]; |
||
29 | self.valueSlider.maximumValue = [[self.setting valueForKey:InAppSettingsSpecifierMaximumValue] floatValue]; |
||
30 | self.valueSlider.minimumValueImage = [UIImage imageWithContentsOfFile:minImagePath]; |
||
31 | self.valueSlider.maximumValueImage = [UIImage imageWithContentsOfFile:maxImagePath]; |
||
32 | CGRect valueSliderFrame = self.valueSlider.frame; |
||
33 | valueSliderFrame.origin.y = (CGFloat)round((self.contentView.frame.size.height*0.5f)-(valueSliderFrame.size.height*0.5f)); |
||
34 | valueSliderFrame.origin.x = InAppSettingsCellPadding; |
||
35 | valueSliderFrame.size.width = InAppSettingsScreenWidth-(InAppSettingsTotalTablePadding+InAppSettingsTotalCellPadding); |
||
36 | self.valueSlider.frame = valueSliderFrame; |
||
37 | |||
38 | self.valueSlider.value = [[self.setting getValue] floatValue]; |
||
39 | } |
||
40 | |||
41 | - (void)setupCell{ |
||
42 | [super setupCell]; |
||
43 | |||
44 | //create the slider |
||
45 | self.valueSlider = [[UISlider alloc] initWithFrame:CGRectZero]; |
||
46 | [self.valueSlider addTarget:self action:@selector(slideAction) forControlEvents:UIControlEventTouchUpInside]; |
||
47 | [self.contentView addSubview:self.valueSlider]; |
||
48 | } |
||
49 | |||
50 | - (void)dealloc{ |
||
51 | [valueSlider release]; |
||
52 | [super dealloc]; |
||
53 | } |
||
54 | |||
55 | @end |