1
我創建了我定製的滑塊這樣如何定製滑塊?
UIImage *image = [UIImage imageNamed:@"thumb.png"];
CGRect frame = CGRectMake(22.5, 220.0, 280.0, 20.0);
UISlider *myslider = [[UISlider alloc] initWithFrame:frame];
[myslider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
[myslider setBackgroundColor:[UIColor clearColor]];
[myslider setThumbImage:image forState:UIControlStateNormal];
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"leftLineImage.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"SlideRight.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
[myslider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[myslider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
myslider.minimumValue = 0.0;
myslider.maximumValue = 100.0;
myslider.continuous = YES;
myslider.value = 5.0;
[self.view addSubview:myslider];
在這個滑塊我已經採取滑塊的左履帶圖像及磁頭正確的軌道圖像兩個圖像的大小是相同的我已經做到了這一點通過調整預覽的大小,但仍我正在讓我的左側曲目圖像更大,我該如何解決這個問題。 和我的第二個問題 我已經調用滑塊值更改的事件,但我需要調用滑塊完全滑動或滑塊值時獲得100的事件我怎麼能這樣做也。