Created
August 10, 2012 20:27
-
-
Save tpthn/3317599 to your computer and use it in GitHub Desktop.
iOS - Some basic info about UISlider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//setup a UISlider programmatically | |
mySlider = [[[UISlider alloc] initWithFrame:CGRectMake(174, 12, 120, 23)] autorelease]; | |
mySlider.maximumValue = 100; | |
mySlider.minimumValue = 30; | |
mySlider.value = 100; | |
[mySlider addTarget:self action:@selector(dimScreen:) forControlEvents:UIControlEventValueChanged]; | |
//adding the slider to a table cell | |
cell.textLabel.text = @"My Slider"; | |
cell.accessoryView = mySlider; | |
//implement the slider function call | |
- (void) dimScreen: (id)sender{ | |
NSLog(@"%f", [(UISlider *)sender value]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment