views:

26

answers:

1

I have a UIScrollView that contains a UIView onto which I am drawing a rather complex graphic using CGPaths. After the view finishes loading the graphic is distorted in that it is elongated horizontally and vertically. If I redraw it, it looks normal.

Any ideas on what is causing this and how to fix it?

+1  A: 

When you initialise your UIView, use initWithFrame and set the frame to the correct size that it will be after everything is drawn, etc. If you are not sure here are some ideas:

  • Get the 'bounds' of the parent view.
  • Call layoutSubviews on the root view, then get its frame, then create your UIView and add it to its parent.
jhabbott
That looks to be the problem. Thanks.