UIImageView边框问题
我正在向我的 UIImageView 子类添加一个边框,效果很好:
self.layer.borderColor = [UIColor whiteColor].CGColor;
self.layer.borderWidth = 10;
但是,在将 UIImageView 添加到图像顶部时,我注意到边框覆盖了图像!
UIImage*pin = [UIImage imageNamed:@"PinDown2"];
UIImageView*view = [[UIImageView alloc] initWithImage:pin];
view.frame = CGRectMake(self.bounds.size.width/2, 0, 32, 39);
[self addSubview:view];
我该如何解决这个问题?
I'm adding a border to a UIImageView subclass of mine which works great:
self.layer.borderColor = [UIColor whiteColor].CGColor;
self.layer.borderWidth = 10;
Upon adding a UIImageView to the top of the image however, I noticed that the border is covering the image up!
UIImage*pin = [UIImage imageNamed:@"PinDown2"];
UIImageView*view = [[UIImageView alloc] initWithImage:pin];
view.frame = CGRectMake(self.bounds.size.width/2, 0, 32, 39);
[self addSubview:view];
How can I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您找不到任何替代方案,请尝试这个,
链接 1
或此,
链接 2
两者都来自同一篇文章。您还可以在那里找到其他答案。
If you don't find any alternative, try this,
Link 1
or this,
Link 2
Both are from same post. You can also find other answers there.