当我设置锚点时,我的图像没有加载

Len*_*ena 5 core-graphics objective-c ipad ios

我有一个UIView,我正在加载我的图像视图作为子视图.当我没有设置锚点时图像显示,但每当我设置锚点时图像都没有显示.我还添加了QUARTZCore框架工作.

我在下面添加我的代码

CGRect apprect=CGRectMake(0, 0, 1024, 768);
UIView *containerView = [[UIView alloc] initWithFrame:apprect1];
containerView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:containerView];

handleView1= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"large.gif"]];
[handleView1 setAlpha:1];
//[handleView1 setFrame:CGRectMake(390, 172.00, 56.00, 316.00)];
handleView1.userInteractionEnabled = YES;
handleView1.layer.anchorPoint=CGPointMake(490.0, 172.0);
[containerView addSubview:handleView1];
Run Code Online (Sandbox Code Playgroud)

Nic*_*ver 6

问题是您用于anchorPoint的值.您不要将帧的位置设置为值.让我引用Apple:

anchorPoint属性是一个CGPoint,它指定与位置坐标对应的图层边界内的位置.锚点指定边界相对于位置属性的定位方式,以及作为应用变换的点.它以单位坐标系表示 - (0.0,0.0)值最靠近图层的原点,(1.0,1.0)位于对角.

在此输入图像描述

看看层几何和变换的核心动画编程指南了解更多详情.