本文介绍了如何阅读UISlider拇指图像的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在UISlider中将拇指放在拇指上方的另一个UIView。为此,我需要拇指图像的宽度。在iOS6中,这很好用。我可以使用:

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:

CGFloat thumbWidth = self.navSlider.currentThumbImage.size.width;

(如答案所示:)

这在iOS7中返回0.0f。我也试过用它来阅读:

This returns 0.0f in iOS7. I've also tried reading it using:

UIImage *thumb = [self.navSlider thumbImageForState:UIControlStateNormal];

但拇指最终为零。

是否可以读取默认滑块拇指图像的大小?或者我必须找到它,设置一个常量,以及Apple如何在以后不改变它?

Is it possible to read the size of the default slider thumb image? Or will I have to find it, set a constant, and how Apple doesn't change it later?

推荐答案

关于 currentThumbImage 属性说:

<$>上的文档c $ c> thumbImageForState:不太清楚:

我想你可能是运气不佳试图找出默认的拇指大小。如何安装看起来与系统映像完全相同的自定义拇指图像?这样就可以解决苹果公司从你身下改掉它的问题。

I think you might be out of luck trying to figure out the default thumb size. How about installing a "custom" thumb image that looks exactly like the system image? That would solve the problem of Apple changing it out from under you.

这篇关于如何阅读UISlider拇指图像的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 00:19