I'm converting a view from shocks and struts to autolayout but now the custom drawing code that is in drawRect is not being called. Is this expected behavior and if so how can I work around this?
Asked
Active
Viewed 1,167 times
7
-
Can you see what are the values of origin & size of `frame` in `initWithFrame:` or `initWithCoder:`? – Arek Holko Oct 19 '13 at 11:55
-
origin=(x=0, y=0) size=(width=0, height=1440). Why would the width be 0? – adam0101 Oct 19 '13 at 15:32
-
Were you checking if it was called by adding a breakpoint in `drawRect:`? – Arek Holko Oct 19 '13 at 15:39
-
Yeah I put one on initWithFrame to get the coordinates, then had another one on drawRect. Does it matter that it's a UIView on a UIScrollView? – adam0101 Oct 20 '13 at 00:32
1 Answers
6
In your view's init (our in the class where you instantiate your view) set the ContentMode:
yourView.contentMode = UIViewContentModeRedraw;

The Windwaker
- 1,054
- 12
- 24