티스토리 뷰
두 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
댓글