我想動態創建一些滑塊動態創建一些滑塊/滑塊不動
隨着我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];
}
}
工作的很好謝謝 – jeff
@ user2207904:沒有問題:) –
@ user2207904:然後你可以接受答案:) –