创建具有多个标签的自定义按钮

发布于 2024-09-17 11:29:08 字数 221 浏览 1 评论 0原文

是否可以创建一个带有多个标签的按钮?例如imageView、textLabel 和detailTextLabel。

我认为使用界面生成器是不可能的,但也许我们可以通过将 UIImage 和 UILabels 添加到按钮的视图来以编程方式完成此操作。如果我确实编写了一个自定义 UIButton 类,那么处理状态更改的最佳方法是什么?

另外,我只是好奇苹果是否会批准带有多个标签和图像的自定义按钮。

Is it possible to create a button with multiple labels? e.g. imageView, textLabel and detailTextLabel.

I don't think it's possible using interface builder, but maybe we can do it programmatically by adding the UIImage and UILabels to button's view. If i do write a custom UIButton class, what's the best way to handle the state changes?

Also, I'm just curious whether Apple will approve a custom button with multiple labels and an image.

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

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

发布评论

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

评论(1

原谅过去的我 2024-09-24 11:29:08

您可以创建一个包含所有这些子视图的视图,并在其上放置一个自定义透明按钮以获取对该视图的点击。要处理状态,您可以将按钮绘制为半透明并带有一些灰色调背景,以产生禁用按钮的效果。华泰

You can create a view with all these subviews and put on it a custom transparent button to get clicks on this view. To handle states you can draw the button semitransparent with some gray toned background to make an effect of disabled button. HTH

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