简体   繁体   English

加载视图时崩溃

[英]crash when loading the View

I have a button named settings , when I press this button the application crashes. 我有一个名为settings的按钮,当我按下此按钮时应用程序崩溃。

I have doubt in warnings that's why I'm going to show you what I got when building: 我怀疑警告这就是为什么我要告诉你建造时我得到的东西:

 .../RechercherViewController.m:66: warning: 'UISlider' may not respond to '-setShowValue:'

that warning is pointing me at this line in the viewDidLoad method: 该警告指向我在viewDidLoad方法中的这一行:

[rayonDeRechercheSlider setShowValue:YES];

rayonDeRechercheSlider is a UISlider declared in the .h file of the View : rayonDeRechercheSlider是在View的.h文件中声明的UISlider:

IBOutlet UISlider *rayonDeRechercheSlider;

UISlider does not use a boolean property called showValue and also UISlider does not offer any explicit method called setShowValue: , hence the method call: setShowValue:YES on a UISlider will crash the app. UISlider不使用称为布尔属性showValue也UISlider不提供任何明确的方法称为setShowValue:因此该方法调用: setShowValue:YESUISlider会崩溃的应用程序。

You may want to call [rayonDeRechercheSlider setValue:1.0 animated:YES] (replace 1.0 with the value you intend to set. 您可能想要调用[rayonDeRechercheSlider setValue:1.0 animated:YES] (将1.0替换为您要设置的值。

After a little further research of where you might have gotten the idea of setShowValue: being a valid selector. 在进一步研究之后,您可能已经了解了setShowValue:作为一个有效的选择器。 I ran across this custom class called UISliderControl 我跑过这个名为UISliderControl自定义类

Maybe this is what you are looking for? 也许这就是你要找的?

EDIT: 编辑:

More Info 更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM