将小图像放在 UIImageView 的顶部?
我在页面中有一个 UIImageView,它从界面生成器获取其图像,我试图在其顶部放置小图标(这是一个小地图,我想在其上放置图标)。我知道这可能非常简单,但我尝试在文档中查找它,但这让我更加困惑。
I've got a UIImageView in a page that gets its image from the Interface builder and I'm trying to put small icons on the top of it (it's a small map and I want to put icons on it). I know it's probably very simple but I tried to look it up in the documentation but it pretty much got me more confused.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Interface Builder,您不能将 UIImageView 拖到现有的 UIImageView 中吗?实际上,您最终会将一个 UIImageView 嵌入到另一个 UIImageView 中。
您还应该能够在代码中轻松设置“小地图”UIImageView 的隐藏属性,具体取决于是否需要该 UIImageView。
希望这有帮助。祝你好运。
Using Interface Builder, can't you just drag a UIImageView into an existing UIImageView? In effect, you end up with one UIImageView embedded within another.
You should also be able to easily set the hidden property of the "small map" UIImageView in code, depending on if that UIImageView is needed or not.
Hope this helps. Good Luck.
您可以通过添加大 UIViewImage 视图和小 UIViewImage 视图来构建自己的 UIView。
我在下面用伪代码说明了我的方法。
you could compose your own UIView by adding both the large and small UIViewImage views.
I have illustrated my approach below with the Pseudocode .
尝试以下代码:
UIImageView *backgroundImageView = (UIImageView *)[self viewWithTag:kBckGndImag];
try this code:
UIImageView *backgroundImageView = (UIImageView *)[self viewWithTag:kBckGndImag];