以下代碼爲動作提供了動畫,即使我沒有使用beginAnimations:context
。我如何在沒有動畫的情況下移動它?這是一個新的iPhone視圖項目,這是它的唯一更新。在移動CALayers時禁用動畫
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
sublayer = [CALayer new];
sublayer.backgroundColor = [[UIColor redColor] CGColor];
sublayer.frame = CGRectMake(0, 0, 100, 100);
[self.view.layer addSublayer:sublayer];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
sublayer.position = [[touches anyObject] locationInView:self.view];
}
或'setDisableActions:YES' – Sulthan 2012-10-03 21:26:13