이미지 자르기
- (IBAction)CaptureAction:(id)sender {
NSLog(@"캡쳐 버튼 눌렸습니다.");
CGSize screenS = myImageView.frame.size;
CGFloat delX = myImageView.image.size.width / screenS.width;
CGFloat delY = myImageView.image.size.height / screenS.height;
NSLog(@"myImageView.image.size.width : %f" ,myImageView.image.size.width );
NSLog(@"myImageView.image.size.height : %f" ,myImageView.image.size.height );
NSLog(@"screenS.width : %f" ,screenS.width );
NSLog(@"screenS.height : %f" ,screenS.height );
NSLog(@"delX : %f" ,delX );
NSLog(@"delY : %f" ,delY );
NSLog(@"viewFinder.frame.origin.x : %f" ,viewFinder.frame.origin.x );
NSLog(@" viewFinder.frame.origin.y : %f" ,viewFinder.frame.origin.y );
NSLog(@"viewFinder.bounds.size.width : %f" ,viewFinder.bounds.size.width );
NSLog(@"viewFinder.bounds.size.height : %f" ,viewFinder.bounds.size.height );
NSLog(@"***********************************************************************" );
NSLog(@"viewFinder.frame.origin.x * delX : %f" ,viewFinder.frame.origin.x * delX );
NSLog(@" viewFinder.frame.origin.y * delY : %f" ,viewFinder.frame.origin.y * delY );
NSLog(@"viewFinder.bounds.size.width * delX : %f" ,viewFinder.bounds.size.width * delX);
NSLog(@"viewFinder.bounds.size.height * delY : %f" ,viewFinder.bounds.size.height * delY );
CGRect sourceRect = CGRectMake(viewFinder.frame.origin.x * delX, (viewFinder.frame.origin.y -110)* delY, viewFinder.bounds.size.width * delX, viewFinder.bounds.size.height * delY);
CGImageRef imageRef = CGImageCreateWithImageInRect(myImageView.image.CGImage, sourceRect);
UIImage *cropImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
ImageVC *imageVC = [[ImageVC alloc]init];
imageVC.cropedimage = cropImage;
[self presentViewController:imageVC animated:YES completion:nil];
}
'ios 뽀개기 > objective-c' 카테고리의 다른 글
코어오디오 MediaPlayer 구현 (1) | 2019.03.04 |
---|---|
엔터프라이즈 계정으로 배포 (0) | 2019.02.15 |
UIpangesture로 UIView 옮기기& 특정 프레임 넘어가지 않게 설정 (0) | 2019.01.25 |
일정시간이 지난 파일 자동 삭제하기 (0) | 2019.01.09 |
날짜데이터를 문자로 변환 (0) | 2019.01.09 |
댓글