我如何子类化 UIView?

发布于 2024-08-07 01:40:25 字数 51 浏览 1 评论 0原文

这似乎是一个愚蠢的问题,但我不太记得如何子类化 UIView。有人能指出我正确的方向吗?

This may seem like a stupid question, but i can't quite remember how to subclass a UIView. Can anyone point me in the right direction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七月上 2024-08-14 01:40:25

示例(.h 文件):

#import <UIKit/UIKit.h>

@interface MySubclassedView : UIView 
{

}

@end

或者,只需向项目添加一个新类并告诉 XCode 子类 UIView 即可创建模板。

example (.h file):

#import <UIKit/UIKit.h>

@interface MySubclassedView : UIView 
{

}

@end

Or, just add a new class to your project and tell XCode to subclass UIView and the template will be created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文