Hi,
Can someone please help me write the following, without using dot notation:
self.bounds.size.width
I have tried [[[self bounds] size] width]
, but this results in an error. Any ideas?
Hi,
Can someone please help me write the following, without using dot notation:
self.bounds.size.width
I have tried [[[self bounds] size] width]
, but this results in an error. Any ideas?
You have brushed up against the ambiguity of dot syntax.
You want:
[self bounds].size.width
-bounds
returns an NSRect
C structure. Thus, you use traditional dots to access the items within.
To avoid mixed notation, I might prefer to use a local temporary C struct variable:
CGRect myBoundsRect = [ self bounds ];
foo = myBoundsRect.size.width;
That way the difference between object messages and C structure member accesses is explicitly separated.