2015-01-25 3 views
2

layer.borderColorCGContextSetStrokeColorWithColor으로 비 정사각형 PNG 이미지 주위에 테두리를 추가하려고 시도하지만 실제 이미지 주위의 이미지 주위에 사각형 테두리가 생겨납니다.비 정사각형 UIImage에 경계 추가

이 방법이 있습니까?

+0

UIImageView에서 이미지를 설정 하시겠습니까? –

+0

그리기는하지만 uiimageview에 대한 방법이 있다면 잘 할 수 있습니다. – sarunw

+0

시도해보십시오. http://stackoverflow.com/questions/25807455/draw-border-around-content-of-uiimageview –

답변

0

둥근 ImageView를 원한다면.

UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@""]]; 
imageView.layer.borderColor = [UIColor blackColor].CGColor; // Apply Color of your choice 
imageView.layer.borderWidth = 2.0; // Apply width of your choice 
imageView.layer.cornerRadius = 50; // Apply radius of your choice 
imageView.clipsToBounds = YES; 
+3

아니요, 둥근 이미지가 아닙니다. 정사각형이 아닌 이미지, 즉 별, 달 등 – sarunw