Reputation: 66485
Ever since I've updated my XCode, the MinimumTrackImage
on my UISlider is now stretching, when before it was clipping like I wanted it to. The MaximumTrackImage
's behavior didn't change.
How can I get the MinimumTrackImage
to not stretch? Note that I use rubymotion, but a solution using obj-c is also acceptable.
Upvotes: 3
Views: 994
Reputation: 154671
I'm guessing here (you are allowed to guess on StackOverflow as long as you're honest about it)... There is a new iOS6 feature for images and perhaps that is getting in your way here. You can set the resizingMode
and capInsets
for an image. Try this:
// Objective-C
UIImage *newImage = [oldImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
# RubyMotion
newImage = oldImage.resizableImageWithCapInsets(UIEdgeInsetsZero, resizingMode:UIImageResizingModeTile)
If you need to adjust the insets as well, replace UIEdgeInsetsZero
with UIEdgeInsetsMake(top, left, bottom, right)
where top
, left
, bottom
, and right
are floats
. In RubyMotion, I believe you can just use [top, left, bottom, right]
.
Info came from here: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImage_Class/Reference/Reference.html
Upvotes: 7