self.messageView.frame.size.height = self.messageView.frame.size.height + notesHeight;
notesHeight is a CGFloat.
You are able to assign the frame, but not the fields of frame
CGRect temp = self.messageView.frame;
temp.size.height = temp.size.height + notesHeight;
self.messageView.frame = temp;
Dot syntax is just syntax sugar.
In this case, this code:
self.messageView.frame.size.height = 0;
Dropping the dot syntax, which causes confusion in some cases about exactly what's happening, it looks like this:
[[self messageView] frame].size.height = 0;
In C terms, that's like this:
ViewGetFrame(GetMessageView(self)).size.height = 0;
You can't set a field of a function result structure this way. (And even if you could, it wouldn't affect the original but only a copy.)
Note that Apple does handle some other things that don't seem like they should work based on these rules automatically (though they didn't when dot syntax was first introduced).
Assuming foo
is a NSInteger property, for instance:
self.foo++;
The Wikipedia article on Value has a section on assignment that might clarify the strut problem:
I'm not aware of any place where Apple defines things that work anyway…
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