iOS7 Custom setMaximumTrack Image with UISlider doesn't show on the device

StackOverflow https://stackoverflow.com/questions/23647875

  •  22-07-2023
  •  | 
  •  

سؤال

I am using custom "UISlider" to show progress bar of MPMoviePlayer. Its working fine in simulator but when i run the same on device it does not apply the image which i provide instead it shows the default behaviour I am using the following code:

UISlider *slider;
[slider setMinimumTrackImage:[UIImage imageNamed:@"progress_bar_active.png"] forState:UIControlStateHighlighted];
[slider setMaximumTrackImage:[UIImage imageNamed:@"progress_bar_background_upper.png"] forState:UIControlStateNormal];
[slider setThumbImage:[UIImage imageNamed:@"thumb.png"] forState:UIControlStateNormal];

It is just really strange.My device is iPad 2(7.0.6),iPad3(7.0.4) and Xcode Version is 5.1.1.

Thanks in Advance.

هل كانت مفيدة؟

المحلول

Try add state UIControlStateNormal to setMinimumTrackImage and setMaximumTrackImage

[slider setMaximumTrackImage:[UIImage imageNamed:@"progress_bar_background_upper.png"] forState:UIControlStateNormal];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top