Reputation: 1
I need to change slider colors in my iphone app, and I put This:
- (UISlider *)ratioSlider
{
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"grayslide.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"grayslide.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
[ratioSlider setThumbImage: [UIImage imageNamed:@"slider_ball.png"] forState:UIControlStateNormal];
[ratioSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[ratioSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
}
in the "myVIewController.m" file, like in the UICatalog apple example file. I've added all of the images and defined the slider, but all that comes up on the simulator is a normal slider, and the only error/warning in XCode is a warning saying "Warning: control reaches end of non-void function". How do I get this code to work?
Upvotes: 0
Views: 1290
Reputation: 777
I think you gone the wrong way around.
Instead of trying to change it to a void action, why don't you
return ratioSlider;
at the end of your method.
(Don't forget to checkout the viewDidLoad
method on ControlsViewController.m in UICatalog to see how the customSlider is actually created, as this may also be confusing matters).
Upvotes: 0
Reputation: 13417
Well, the warning:
Warning: control reaches end of non-void function
Is because your not returning an object of type UISlider * based on your message signature:
- (UISlider *)ratioSlider
Upvotes: 1