【发布时间】:2012-04-10 20:32:34
【问题描述】:
我正在尝试在下面的代码中设置我的CALayer 的框架
CGRect VFrame;
VFrame = CGRectMake(self.viewNo2.frame.origin.x, self.viewNo2.frame.origin.y, self.viewNo2.frame.size.width, self.viewNo2.frame.size.height);
self.customLayer = [CALayer layer];
self.customLayer.frame = VFrame;
self.customLayer.contentsGravity = kCAGravityResizeAspectFill;
[self.view.layer addSublayer:self.customLayer];
由于某种原因,该层位于此框架周围的某个位置,但不是我要声明的框架。
有谁知道问题出在哪里?
【问题讨论】:
-
您是否应用了任何转换或任何东西?我也经常发现在处理
CALayers时使用bounds和position更容易。 -
你所说的“...ayer 在这个框架周围的某个地方,但不是我想要声明的框架”是什么意思?
-
你找到解决办法了吗?
标签: iphone ios xcode calayer subview