0
카메라에서 사진을 찍으려고하고 화면의 일부 위치로 이동/회전/크기 조정 된 UIButton에서 이미지를 오버레이하려고합니다.UIButton에서 이미지로 이미지를 올바르게 배치하는 방법은 무엇입니까?
아래 코드는 이미지를 올바르게 회전하지만 적절한 X, Y 좌표에 배치하지 않습니다.
- (UIImage*)dumpOverlayViewToImage {
CGSize imageSize = self.cameraOverlayView.bounds.size;
UIGraphicsBeginImageContext(imageSize);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(ctx, self.button.frame.origin.x, self.button.frame.origin.y);
CGContextConcatCTM(ctx, self.button.transform);
[self.button.imageView.image drawAtPoint:CGPointMake(0,0)];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
도움을 주시면 대단히 감사하겠습니다.
보기 계층 구조는 어떻게 생겼습니까? self.button과 self.cameraOverlay는 같은 슈퍼 뷰의 자식입니까? 디버거 콘솔에서'po [[(id) UIApp keyWindow] recursiveDescription]'을 실행하고 결과를 질문에 붙여 넣으십시오. –