Skip to content

Instantly share code, notes, and snippets.

@tpthn
Created August 10, 2012 20:27
Show Gist options
  • Save tpthn/3317599 to your computer and use it in GitHub Desktop.
Save tpthn/3317599 to your computer and use it in GitHub Desktop.
iOS - Some basic info about UISlider
//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