我知道每個imageView都有一個圖層(我們可以通過它訪問它:imageView.layer)。我想使用我的圖層imageView
並向它的圖層添加一個subLayer:shapeLayer
(這是一個CAShapeLayer)我的代碼不起作用,它不顯示形狀圖層!將subLayer添加到imageView.layer
- (void)viewDidLoad
{
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
[self.view addSubview:imageView];
}
- (void)anotherMethod
{
[imageView.layer addSublayer:shapeLayer];
}
我該如何解決這個問題?
沒有它不工作:( – 2011-12-25 19:10:39