开发者

How to overcome UISlider customization memory leak?

开发者 https://www.devze.com 2023-03-29 03:08 出处:网络
I\'m customizing my UISlider as below, IBOutlet UISlider* pageSlider; /* Slider Customization */ UIImage *sliderImg = [UIImage imageNamed:@\"slider.png\"];

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..

0

精彩评论

暂无评论...
验证码 换一张
取 消