我想为UI
ImageView添加白色边框.我尝试了以下,但它不起作用:
UIImage *image = [UIImage imageNamed:imagePath]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; CGRect rect = imageView.frame; rect.size.width = rect.size.width + 1; // create white right border [imageView setBackgroundColor:[UIColor whiteColor]]; imageView.frame = rect; [myViewView addSubview:imageView];
解决方法
我现在就这样做了
CALayer *sublayer = [CALayer layer]; sublayer.backgroundColor = [UIColor whiteColor].CGColor; sublayer.frame = CGRectMake(imageView.bounds.size.width,1,imageView.frame.size.height); [imageView.layer addSublayer:sublayer];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。