I’m not sure if I’m posting this in the correct place, but I have a question about dot notation. Firstly, I have to say that I’m more a fan of bracket notation, but that might be because i’m not 100% clear on dot notation.
So first of all I understand if I have something like this:
BNRItem *item = [[BNRItem alloc] init];
[item setValueInDollars: 10]; it’s the same as writing item.valueInDollars = 10;
What I don’t understand are things like this self.window.backgroundColor = [UIColor whiteColor]; How could something like this be written using the bracketed notation? It seems writing [self.window setBackgroundColor: [UIColor whiteColor]; works, at least when I build I get no errors. But is there a way to get rid of the . between self & window (i.e turn self.window into [self window])?
I know i must be missing something, but if i see something written with two dots (i.e self.window.backgroundColor or screenRect.origin.x) I’m not clear on what is going on. Ultimately I’m trying to really understand dot notation as it seems to be used a lot, so hopefully My question is clear