将子视图添加到UIImageView,它是IB中UIViewController的视图出口 [英] Add a subview to a UIImageView that is the view outlet of a UIViewController in IB

查看:84
本文介绍了将子视图添加到UIImageView,它是IB中UIViewController的视图出口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.xib文件中有一个UIViewController对象。我添加了一个UIImageView,然后尝试添加一个按钮作为UIImageView的子视图。它取代了UIImageView。如果两者都是UIView的子视图,它工作正常。是什么赋予了?我认为这可行,因为UIImageView是UIView的子类?

I have a UIViewController object in a .xib file. I add a UIImageView to it, and then try to add a button as a subview of the UIImageView. It instead replaces the UIImageView. It works fine if both are subviews of a UIView. What gives? I thought this would work since UIImageView is a subclass of UIView?

推荐答案

只有Apple知道。

但是,请看这里找一个解决方法:

However, look at here for a workaround:

Apple Interface Builder:将子视图添加到UIImageView

这篇关于将子视图添加到UIImageView,它是IB中UIViewController的视图出口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆