How to overcome UISlider customization memory leak?
I'm customizing my UISlider as below,
IBOutlet UISlider* pageSlider;
/* Slider Customization */
UIImage *sliderImg = [UIImage imageNamed:@"slider.png"];
UIImage *scaledImage = [UIImage imageWithCGImage:[sliderImg CGImage] scale:2.0 orientation:UIImageOrientationUp];
[pageSlider setThumbImage:scaledImage forState:UIControlStateNormal];
UIImage *sliderLeftTrackImage = [[UIImage imageNamed: @"slider_line.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0];
UIImage *sliderRightTrackI开发者_JAVA百科mage = [[UIImage imageNamed: @"slider_line.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0];
[pageSlider setMinimumTrackImage: sliderLeftTrackImage forState: UIControlStateNormal];
[pageSlider setMaximumTrackImage: sliderRightTrackImage forState: UIControlStateNormal];
and for assigning the current selection value i'm using
[pageSlider setValue:_pageNumber+1 animated:YES];
when i run my code with instruments leaks are showing in the above set of code only , can anybody help. Any help is appreciated in advance, thanks.
I cant find any conclusive leaks in your code...But I think this thread might interest you...imageWithCGImage looks like the culprit..
精彩评论