0

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 *sliderRightTrackImage = [[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.

Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
George
  • 352
  • 2
  • 5
  • 15
  • 1
    Hi, Arun! Do you retain your pageSlider? And where do you release it? – Zapko Aug 17 '11 at 06:32
  • i'm not retaining "IBOutlet UISlider* pageSlider" but i'm releasing it in dealloc() function,can you suggest me the correct way to manage this? – George Aug 17 '11 at 06:56
  • The best way to manage outlets is to assign them to retaining properties. `@property (nonatomic, retain) IBOutlet UISlider *pageSlider;` And release them in 2 places: dealloc and viewDidUnload if we are talking about UIViewController. `self.pageSlider = nil;` But it is unlikely that this is the issue. Have you tried to comment some of this images and check what would happen? – Zapko Aug 17 '11 at 11:13

1 Answers1

0

I cant find any conclusive leaks in your code...But I think this thread might interest you...imageWithCGImage looks like the culprit..

Community
  • 1
  • 1
Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167