How do I call a IBAction method from within another method
Hi I am trying to call a method from a method, I am getting incompatible type for slider changed on the code where I am calling the method from:
[self EVsliderChanged: (float)EVslider.value ];
I assume that means that float is not the right type for uislider.value? or perhaps it is expecting me to pass it something different, bellow is the psudo code from .m :
- (IBAction) EVsliderChanged:(UISlider *)sender {
// code I want to run if either EVSliderChanded or PickerView changes
}
- (void)pickerView:(UIPickerView *)secPicker didSelectRow:(NSInteger)row inComponent (NSInteger)component {
[self EVsliderChanged: (float)EVslider.value ];
}
I'm sure I'm doing someth开发者_运维技巧ing n00bishly wrong, could someone please explain whats going wrong and give me an example of how to do it right.
Thanks
EVsliderChanged:
method expects UISlider as paramater, not its value - so your call should be
[self EVsliderChanged:EVslider ];
And slider's value to be retrieved inside the method.
P.S. Note also that method and ivar names in objective-c usually start with lower case - just a convention, but still...
精彩评论