如何将UIView插座连接到自定义子视图 [英] How to connect UIView outlets to a custom subview

查看:76
本文介绍了如何将UIView插座连接到自定义子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还是xcode / iOS新手并且遇到以下问题:

I'm still new to xcode / iOS and have the following problem:

为了显示一些移动调试信息,我添加了UIview作为/我的一个Viewcontroller的outlet-property。此视图是UIview的自定义子类。现在我添加了一些UIlabel作为此视图的子视图,并希望将这些标签的插座连接拖到我的customUIview.h文件中,以便可以将这些标签作为我的自定义UIview类的属性进行访问(无需直接从查看控制器)。

in order to display some mobile debug information, I have a UIview added/connected as outlet-property to one of my Viewcontroller. This view is a custom subclass of UIview. Now I addeddd some UIlabels as sub views to this view and want to drag the outlet connections from these labels to my customUIview.h file in order to have these labels accessible as properties of my custom UIview class (no need to access them directly from the view Controller).

问题是界面构建器(我使用的是Storyboards / xcode4.3)没有成功。我可以将插座连接到ViewControllerClass.h,但不能连接到我的子视图的.h文件。
有谁可以指出问题出在哪里?

Problem is that the interface builder (I'm using Storyboards/ xcode4.3) does not make the trick. I can connect the outlets to the ViewControllerClass.h but not to my sub view's .h file. Can anyone point out where the problem is?

推荐答案

刚刚解决了问题。在customview.h文件中手动输入属性插座声明后,我可以将它们从那里按住它们拖动到它们在接口生成器中对应的UIlabel对象。仅适用于此方向!

Just solved the problem. After typing the property outlet declarations manually in the customview.h file I could ctrl-drag-connect them from there to their corresponding UIlabel objects in the interfacebuilder. Works only in this direction!

非常感谢

这篇关于如何将UIView插座连接到自定义子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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