반응형
- (UIImage *)imageWithInsets:(CGRect)insetRect image:(UIImage *)image {
CGRect newRect = CGRectMake(0.0, 0.0, insetRect.origin.x+insetRect.size.width+image.size.width, insetRect.origin.y+insetRect.size.height+image.size.height);
// Setup a new context with the correct size
UIGraphicsBeginImageContextWithOptions(newRect.size, NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
UIGraphicsPushContext(context);
// Now we can draw anything we want into this new context.
CGPoint origin = CGPointMake(insetRect.origin.x, insetRect.origin.y);
[image drawAtPoint:origin];
// Clean up and get the new image.
UIGraphicsPopContext();
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
반응형
'iOS' 카테고리의 다른 글
iOS iP주소 가져오기 (0) | 2019.05.30 |
---|---|
UIImage 이미지 자르기 (0) | 2019.05.30 |
NSDictionary 또는 NSArray에서 JSON 문자열을 생성 하기 (0) | 2019.05.30 |
NSArray 의 빈값 체크 (0) | 2019.05.30 |
선택된 셀의 인덱스 불러오기 (0) | 2019.05.30 |