iPhone UISlider not visible

Posted by John Qualis on Stack Overflow See other posts from Stack Overflow or by John Qualis
Published on 2010-06-02T21:02:47Z Indexed on 2010/06/02 21:24 UTC
Read the original article Hit count: 263

Filed under:
|

I want to add a UISlider to my app programmatically without using the IB. I am adding a UISlider to my UIViewController using the code below. However I don't see the slider when the view comes up. What am I missing? I am using iPhone SDK 3.1.2. Appreciate any help.

@synthesize slider;
....

- (void)viewDidLoad {
...
...
slider = [[UISlider alloc] initWithFrame: CGRectMake(0, 480 - 80, 300, 20)];
slider.minimumValue = 0.0;
slider.maximumValue = 100.0;
slider.tag = 0;
slider.value = 50;
slider.continuous = YES;
slider.enabled = YES;
[slider addTarget:selfaction:@selector(handleSlider:)forControlEvents:UIControlEventValueChanged];
self.view addSubview:slider];

In the .h file

 ...
    UISlider    *slider;
    ...
    @property (nonatomic, retain) UISlider *slider;
    - (void) handleSlider:(id)sender;

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk