I am drawing a triangle on a UIView
via drawRect
and subsequently add this UIView
as subview of the main view (UIView
).
Very easy and it shows.
The problem occurs when I use an UIImageView
.
UIView
(main view) adding UIImageView
as subview and with thisUIImageView
adding the UIView
as subview onto which I draw the triangle.
Hierarchy:
[UIView] (main view; i.e. self.view)
|
[UIImageView]
|
[UIView] (onto which drawing is)
View creations:
self.view = [[UIView alloc] initWithFrame:(CGRect){{0.0, 0.0}, 320.0, 480.0}];
imageView = [[UIImageView alloc] initWithImage:...];
[self.view addSubview:imageView];
viewWithTriangle = [[MyView alloc] initWithFrame:imageView.bounds];
[imageView addSubview:viewWithTriangle];
The triangle is flipped vertically. The easy fix would be to flip the UIView
vertically again, but I would like to know why adding the UIView
as subview of UIImageView
would cause this flip.
This doesn't occur if I add the view where the drawing is directly as subview of the main view.