Is multiple assignment a hack in Obj-C?

So, I have a class (IKImageView) with a bunch of properties.

I know that view setProp: BOOL returns void. But:

BOOL b = view.prop = NO;

seems to work. If I had a f () function that returns a boolean, does anyone know if it really does:

[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 this:

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 for some reason does not work, but b is set correctly)

a

BOOL b;
[view setHasHorizontalScroller: YES];
b = [view getHasHorizontalScroller];
NSLog(@"b is %d scroll is %d", b, [view getHasHorizontalScroller]);

I get: "b - 0, scroll 0"

It really bothers me. (In addition, if someone can tell me how the YES property setting is turned off, but then he manages to set b ... and yet errors do not occur ...

+5
2

BOOL TMP = f();
[view setProp: TMP];
BOOL b = TMP;

. , , .

, .

+5

, . :

a.text = b.text = c.text;

:

// [c text]
// [b setText:]
// [a setText:]

, [b text] : (

0

All Articles