Does that make sense frame is not used on https://github.com/hivinau/material-components-ios/blob/develop/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m (line 51) ?
Asked
Active
Viewed 57 times
-5
-
1Sorry, can you please add more detail to your question? It is completely unclear what you're asking, or what you need help with. Please post any code that you have problems here, instead of referring to outside sites. – roelofs Dec 18 '17 at 23:16
-
1. Please add the relevant code to your Q. 2. Don't use off-site resources. 3. `frame` is a write only variable. What is the point of this? – Amin Negm-Awad Dec 19 '17 at 03:42
-
I thought _frame_ is useless. I had in fact forgotten fields are **stored in memory** during their lifecycles. – Hivinau.graffe Dec 20 '17 at 13:19
1 Answers
3
It makes sense as you declare frame
, give it an initial value, modify two of its fields, then discard it – so the whole operation was pointless. The compiler has been kind to you in catching this. HTH

CRD
- 52,522
- 5
- 70
- 86
-
Note that, if we proceed in the same manner on swift language, warning tell us `frame` is unused. That means, view frame is immutable. Why I posed the question. – Hivinau.graffe Dec 21 '17 at 10:16
-
@Hivinau.graffe - Your code doesn't tell you anything about the (im)mutability of view frame, the statement `CGRect frame = self.view.frame` declares a new variable and initialises it with a *value*. After the statement there is *no connection* between the variable `frame` and `self.view`'s `frame` so modifying the former has no effect on the latter. The same would be true if using Swift (`var frame = self.view.frame`). HTH – CRD Dec 21 '17 at 16:55