I was explaining the difference between typing objects with id instead
of UISlider * (in this case) to a friend and came across this weird
behaviour.
Consider the folowing method that is called when chaing the value of a
UISlider:
===
- (IBAction)changeValue:(id)sender
{
[textLabel setText:[NSString stringWithFormat:@"%f", [sender value]]];
}
===
[sender value] in this case returns the actual slider object...
If we cast sender to UISlider everything works as expected.
My first thought was that this behaviour may have to do with
UISlider's -value method returning a float instead of an object.
However if I use [sender maximumValue] which also retuns a float it
works..
So what's the deal with the method name "value" and ObjC runtime?
Paulo F. Andrade
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com