I\'m trying to position an additional UIView centered above the thumb in a UISlider. To do this, I need the width of the thumb image. In iOS6, this works fine. I can use: >
Here is another one that works, however it is a little "hackier" than the first one, and makes an assumption on the default thumb Image width won't change in future versions of iOS (past 11)
- (CGFloat)thumbImageWidth // default thumb image is 30 px,
{
double imgThumbImageWidth = self.currentThumbImage.size.width;
if (imgThumbImageWidth && imgThumbImageWidth != 0 && imgThumbImageWidth != thumbImageWidth) {
thumbImageWidth = imgThumbImageWidth;
}
else if (!thumbImageWidth || thumbImageWidth == 0) { // No custom image set, use 30
thumbImageWidth = 31;
}
return thumbImageWidth;
}