Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
what is the proper syntax to achieve this ultra simple action... grrr... what i have below apparently is incorrect. UISlider's value changed is connected to the action.

Code:
- (IBAction)changeAlpha:(id)sender
       {
       [self.mainView setAlpha:[sender value]];
       }

Error: incompatible type for argument 1 of 'setAlpha'

writing either [sender intValue] or [sender floatValue] (depending on how the slider's values appear) causes a crash.

[edit] nevermind. i figured it out. sender of UISlider can't be generic type (interesting!)... has to be

Code:
- (IBAction)changeAlpha:(UISlider *)sender
 
value is kind of an unfortunate name for UISlider to use for its value.

You either need to typecast the sender to UISlider or typecast value to CGFloat.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.