IBDesignable... 添加自定义操作? [英] IBDesignable... adding custom actions?

查看:26
本文介绍了IBDesignable... 添加自定义操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Xcode 的新手,我认为有一种方法可以做到,但我似乎无法弄清楚.

I'm new to Xcode and I assume there's a way to do it but I can't seem to figure it out.

我通过继承 UIView 和使用 IBDesignable 创建了一个自定义控件.

I have made a custom control by subclassing UIView and using IBDesignable.

但是,我似乎无法弄清楚如何将事件从我的控件内发送到它之外的 IBAction.

However, I can't seem to figure out how to send events from within my control to a IBAction outside of it.

推荐答案

您需要继承 UIControl 而不是 UIView.一旦 Interface Builder 看到一个 UIControl 子类,然后发送事件部分和操作将可用.

You need to subclass UIControl not UIView. Once Interface Builder sees an UIControl subclass then send events section and actions will be available.

访问控件的目标和操作

这篇关于IBDesignable... 添加自定义操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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