tags:

views:

17

answers:

1

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 something n00bishly wrong, could someone please explain whats going wrong and give me an example of how to do it right.

Thanks

A: 

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...

Vladimir
Thanks for the super fast reply. That makes perfect sense thanks. Also I will go back and clean up my vars, I guess that's why they insisted on us using hungarian notation when I learned Java.
stephen