나는를 가지고 있습니다. 인 UITableViewCell
안에 UIImageView
이 있습니다. 둥근 테이블 셀의 (0,0) 위치에 이미지를 배치했습니다. 응용 프로그램을 실행할 때 UIImageView
여전히 왼쪽 된 모서리가 표시됩니다. 셀 안의 Imageview는 클리핑되지 않습니다. UIImageView
의 모서리 반경을 설정하지 않고도 누구나 해결책을 찾을 수 있습니까?UITableViewCell에서 UIImageView의 모퉁이를 숨기기
1
A
답변
2
이 방법은 레이어 마스크와 모서리 반경을 사용하는 것입니다.
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:frame
byRoundingCorners:UIRectCornerAllCorners
cornerRadii:CGSizeMake(5.0, 5.0)];
// Create the shape layer and set its path
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = frame;
maskLayer.path = maskPath.CGPath;
// Set the newly created shape layer as the mask for the image view's layer
imageView.layer.mask = maskLayer;
imageView.layer.cornerRadius = 5.0;
이
frame
귀하의 이미지 뷰의 프레임이라고 가정 : 어떻게 여기입니다. 그리고
#import <QuartzCore/QuartzCore.h>
을 잊지 마세요. 행운을 빕니다!
0
셀의 clipsToBounds
속성을 YES
으로 설정하고 원하는 결과가 표시되는지 확인해보십시오.
관련 문제
- 1. OS 3.0의 UITableViewCell에서 왼쪽 UIImageView의 위치를 변경하십시오.
- 2. 런타임시 UIImageView의 이미지 배경 제거
- 3. UITableViewCell에서 크기를 조정해야하는 이미지 표시
- 4. UITableViewCell에서 버튼이 작동하지 않습니다. UITableViewCell에서 뷰의 하위 뷰일 때
- 5. uiimageview의 URL 표시 이미지
- 6. UIImageView의 일부분 지우기 (고무처럼)
- 7. UIImageView의 화면 비율
- 8. UIImageView의 크기 변경
- 9. UIImageView의 중심 UIActivityIndicatorView
- 10. UIImageView의 밝기 증가/감소
- 11. UIImageView의 애니메이션에 문제가 있습니까?
- 12. UIImageView의 크기가 조정 중입니다.
- 13. UIImageView의 크기를 조정하는 방법?
- 14. UIImageView의 상호 작용
- 15. iPhone UiImageView의 "Wobbly"애니메이션
- 16. UIImageView의 애니메이션에 문제가 있습니다.
- 17. UIImageView의 텍스트 편집기
- 18. UIImageview의 배경 레이어 제거
- 19. uiimageview의 알파 마스크 그라디언트
- 20. UIImageView의 텍스트 입력
- 21. UIImageView의 이미지를 보안 웹에서로드하십시오.
- 22. IBOutlet UIImageView의 크기 알아보기
- 23. UIImageView의 그리드 만들기
- 24. UIImageview의 반사 이미지
- 25. UIImageView의 이미지가 변경되었는지 확인하십시오.
- 26. UIImageView의 고해상도 이미지 디스플레이
- 27. UIImageView의 코코아 터치 터치
- 28. UIImageVIew의 UIImage 부분 표시
- 29. UIImageView의 터치 이벤트
- 30. UIImageView의 위치 변경
Fahri Azimov thaks 좋은 ...하지만 왼쪽 모서리 마스크 ineed이 ... – krishh
그런 다음 경로에 지정하는 것이 -'UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect : 프레임 byRoundingCorners : UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii : CGSizeMake (5.0, 5.0)]' –
Fahri Azimov 예 ... 다시 감사드립니다 ... – krishh