我在UIView
通孔上绘制了一个三角形drawRect
,然后将其添加UIView
为主视图 ( UIView
) 的子视图。
很容易,它显示了。
当我使用UIImageView
.
UIView
(主视图)添加UIImageView
为子视图,并以此UIImageView
添加UIView
我在其上绘制三角形的子视图。
等级制度:
[UIView] (main view; i.e. self.view)
|
[UIImageView]
|
[UIView] (onto which drawing is)
查看创作:
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];
三角形垂直翻转。简单的解决方法是UIView
再次垂直翻转,但我想知道为什么添加UIView
as 子视图UIImageView
会导致这种翻转。
如果我将绘图所在的视图直接添加为主视图的子视图,则不会发生这种情况。