CGlayerRef와 CGcontextRef를 NSdata에 저장했는데 현재 NSlayer에 CGlayerRef와 CGcontextRef를 저장했는데 현재의 NSlayer를 덮어 쓰게되면 Pointer가 저장된 것이지만 데이터는 저장되지 않는다는 것을 알았습니다. 그런 이유로이 CGlayerRef 또는 CGcontextRef를 복사본으로 만들 수 없습니다 (drawRect에서이 작업을 모두 수행했습니다).CGlayerRef 또는 CGcontextRef를 NSdata에 저장할 수없는 이유는 무엇입니까?
왜 일부 NSData는 이러한 내용을 저장할 수 있지만 NSvalue는 작업 할 수는 없지만 작동하지는 않습니다. 전혀, 나는 "사본"을 사용해도 이러한 데이터의 사본을 얻지 못했습니다.
- (무효)의 drawRect : 여기
내 코드입니다 (CGRect) RECT {경우 (drawCount == 3) {
dataLayer1=[NSData dataWithBytes:& _layerView
길이는 sizeof (CGLayerRef)]
[dataLayer1 retain];
}
if (undodo==YES) {
_layerView=*(CGLayerRef*)[dataLayer1 bytes];
}
currentContext = UIGraphicsGetCurrentContext(....