【发布时间】:2012-03-05 18:43:50
【问题描述】:
我想要一个带有两个 UIImageView 子视图的视图 (UIView),
然后在屏幕上(同时)移动这两个图像。
在场景 1 中,我创建了一个具有屏幕尺寸的 UIView,并将其固定不变,
然后移动两个子视图的中心点。在场景 2 中,我创建
a UIView 两个图像的大小,然后围绕屏幕移动UIView 中心点。
我原以为最终结果会是一样的,但事实并非如此。 为什么不呢?
场景 1:
UIView mainView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIImageView firstImage = [[UIImageView alloc] initWithFrame:muchSmallerRect];
UIImageView secondImage = [[UIImageView alloc] initWithFrame:muchSmallerRect];
[mainView addSubview:firstImage];
[mainView addSubview:secondImage];
firstImage.center = someSpecificPoint;
secondImage.center = someSpecificPoint;
场景 2:
UIView mainView = [[UIView alloc] initWithFrame:muchSmallerRect];
UIImageView firstImage = [[UIImageView alloc] initWithFrame:muchSmallerRect];
UIImageView secondImage = [[UIImageView alloc] initWithFrame:muchSmallerRect];
[mainView addSubview:firstImage];
[mainView addSubview:secondImage];
mainView.center = someSpecificPoint;
【问题讨论】:
-
您能否提供更多关于“最终结果的差异”的详细信息?
标签: ios uiview uiimageview