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

Objective c 当我设置锚点时,我的图像没有加载,objective-c,ios,ipad,core-graphics,Objective C,Ios,Ipad,Core Graphics,我有一个UIView,我正在将图像视图作为子视图加载。当我没有设置锚定点时,图像显示,但当我设置锚定点时,图像不显示。我还添加了QUARTZCore框架 我正在下面添加我的代码 CGRect apprect=CGRectMake(0, 0, 1024, 768); UIView *containerView = [[UIView alloc] initWithFrame:apprect1]; containerView.backgroundColor = [UIColor whiteColor]

我有一个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];

问题是您用于锚点的值。您不会将帧位置的点设置为值。让我引用苹果的话:

anchorPoint属性是一个CGPoint 它指定了 对应的层的边界 使用位置坐标。这个 定位点指定边界的方式 是相对于 职位、财产以及服务 作为变换的点 到处申请它以 单位坐标系 (0.0,0.0)值位于距离 图层的原点和(1.0,1.0)为 位于对面的角落。


查看更多详细信息。

首先设置ImageView的框架,然后像这样设置ancherpoint

[handleView1.layer setAnchorPoint:CGPointMake(1,1)]