티스토리 뷰

두 UIView (View1 및 View2) 사이에 하나 이상의 UIView (BorderView)를 추가 할 수 있습니다. 테두리보기에 적절한 너비와 배경색을 지정하십시오.여기에 이미지 설명 입력

-------------------

이러한 테두리를 프로그래밍 방식으로 설정하려면 다음 코드 스 니펫을 사용할 수 있습니다.

+(void)SetImageViewBottomBorder :(UIImageView *)imageView{
    CALayer *border = [CALayer layer];
        CGFloat borderWidth = 1;
            border.borderColor = [[self colorWithHexString:@"9B9B9B"] CGColor];
                border.frame = CGRectMake(0, imageView.frame.size.height - borderWidth,    imageView.frame.size.width, imageView.frame.size.height);
                    border.borderWidth = borderWidth;
                        [imageView.layer addSublayer:border];
                            imageView.userInteractionEnabled  = YES;
                                imageView.layer.masksToBounds = YES;
                                }
                                

UIImageView를 UIView로 바꿀 수 있으며 매력처럼 작동합니다.



출처
https://stackoverflow.com/questions/39940216
댓글
공지사항
Total
Today
Yesterday
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31