我想动态创建一些滑块
使用我的 IBAction create1Slider,我可以移动我的滑块
使用我的 IBAction create10Sliders,我无法移动我的滑块
怎么了?
- (IBAction) create1Slider:(id)sender {
UISlider *slider = [[[UISlider alloc] initWithFrame:CGRectMake(150, 150, 100, 100)] autorelease];
slider.minimumValue = 1;
slider.maximumValue = 255;
slider.continuous = YES;
[self.view addSubview:slider];
}
///////////////////////
- (IBAction) create10Sliders:(id)sender {
for(int i=0; i< 10
; i++)
{
UISlider *slider = [[[UISlider alloc] initWithFrame:CGRectMake(50, 50, 100, 100+i*80)] autorelease];
forControlEvents:UIControlEventValueChanged];
slider.minimumValue = 1;
slider.maximumValue = 255;
slider.continuous = YES;
[self.view addSubview:slider];
//[slider release];
}
}