So, I've got a class (IKImageView) with a bunch of properties.
I know that view setProp: BOOL returns void. However:
BOOL b = view.prop = NO;
seems to work. If I had a function f() that returns a boolean, does anyone know if this is really doing:
[view setProp:f()];
Bool b = [view getProp];
or
[view setProp: f()];
Bool b = f();
or
BOOL TMP = f();
[view setProp: TMP];
BOOL b = TMP;
I ask because when I do:
BOOL b = view.hasHorizontalScroller = YES;
NSLog(@"b is %d scroll is %d", b, [view getHasHorizontalScroller]);
I get "b is 1, scroll is 0" (Which means that setHasHorizontalScroller is failing for some reason, but b is set correctly)
but:
BOOL b;
[view setHasHorizontalScroller: YES];
b = [view getHasHorizontalScroller];
NSLog(@"b is %d scroll is %d", b, [view getHasHorizontalScroller]);
I get "b is 0 scroll is 0"
This is very confusing to me. (Also, if anyone can tell me how the setting of the property to YES fails, but then it succeeds in setting b... and yet no errors come up...
It's doing
BOOL TMP = f();
[view setProp: TMP];
BOOL b = TMP;
There was discussion of this before properties shipped. Some folk thought this should be a compile error to avoid the ambiguity.
It is probably best to avoid the construction entirely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With