gpt4 book ai didi

objective-c - 当我设置 anchor 时,我的图像没有加载

转载 作者:可可西里 更新时间:2023-11-01 04:36:54 27 4
gpt4 key购买 nike

我有一个 UIView,我正在将我的 ImageView 加载为 subview 。当我没有设置 anchor 时图像显示,但每当我设置 anchor 时图像不显示。我还添加了 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];

最佳答案

问题是您用于 anchor 的值。您不会将框架位置之类的点设置为值。让我引用苹果的话:

The anchorPoint property is a CGPoint that specifies a location within the bounds of a layer that corresponds with the position coordinate. The anchor point specifies how the bounds are positioned relative to the position property, as well as serving as the point that transforms are applied around. It is expressed in the unit coordinate system-the (0.0,0.0) value is located closest to the layer’s origin and (1.0,1.0) is located in the opposite corner.

enter image description here

看看Layer Geometry and Transforms in the Core Animation Programming Guide了解更多详情。

关于objective-c - 当我设置 anchor 时,我的图像没有加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5960697/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com