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

objective-c – 当我设置锚点时,我的图像没有加载,第1张

概述我有一个UIView,我正在加载我的图像视图作为子视图.当我没有设置锚点时图像显示,但每当我设置锚点时图像都没有显示.我还添加了QUARTZCore框架工作. 我在下面添加我的代码 CGRect apprect=CGRectMake(0, 0, 1024, 768);UIView *containerView = [[UIView alloc] initWithFrame:apprect1]; 我有一个UIVIEw,我正在加载我的图像视图作为子视图.当我没有设置锚点时图像显示,但每当我设置锚点时图像都没有显示.我还添加了QUARTZCore框架工作.

我在下面添加我的代码

CGRect apprect=CGRectMake(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的值.您不要将帧的位置设置为值.让我引用Apple:

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.

有关详细信息,请查看Layer Geometry and Transforms in the Core Animation Programming Guide.

总结

以上是内存溢出为你收集整理的objective-c – 当我设置锚点时,我的图像没有加载全部内容,希望文章能够帮你解决objective-c – 当我设置锚点时,我的图像没有加载所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1080627.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存