iOS - UILabel 编辑,覆盖图像?

发布于 2024-12-22 07:16:53 字数 252 浏览 0 评论 0原文

正如您可能从我最后几个问题中看出的那样,我正在开发一个允许用户编辑标签的屏幕。页面和所有其他可爱的应用程序都有出色的调整大小手柄,以显示当前正在编辑的标签。

我正在尝试获得一些关于执行此操作的最佳方法的反馈。是否可以在标签所有边缘的中心添加“点”图像?是否可以仅更改标签部分的背景颜色? 或者我应该在标签顶部添加图像并禁用它?最重要的功能是只有 uilabel 可以响应触摸。如果我覆盖图像,我希望它忽略触摸并将其交给标签。

任何反馈表示赞赏! 干杯伙计们!

As you can probably tell from my last few questions, I am working on a screen that allows users to edit labels. Pages and all the other lovely apps have glorious resizing handles to show what label is currently being edited.

I am trying to get some feedback on the best way to do this. Is it possible to add an 'dot' image to the centre of all the edges of the label? Is it possible to change the background colour only in sections of a label?
Or should I add an image on top of the label and disable it? The most important feature is for only the uilabel to respond to touches. If I overlay an image, I want it to ignore the touch and hand it off to the label.

Any feedback appreciated!
Cheers Guys!

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

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

发布评论

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

评论(1

夏末 2024-12-29 07:16:53

有多少程序员,你就会发现多少对此的看法。对于显示每边中间的点的视图没有内置装饰。但你可以很容易地添加它。一种方法是用点实例化图像的四个实例,并将它们添加为您正在装饰的视图的子视图。然后,您可以将每个点的中心设置在父视图中每条边的中心上。只要在父视图中关闭剪切,即使它们延伸到父视图的框架之外,它们也会显示(如果它们没有隐藏)。

我不明白您想要通过更改标签视图部分中的背景颜色来完成什么,但我这可能有一定的复杂性。

您也可以使用核心显卡来实现这一点。不过,我就到此为止。实际上有很多方法可以完成您想做的事情。

You will find as many opinions on this as there are programmers. There is not built-in decoration for a view that shows the dot in the middle of each side. But you can add that easily enough. One way is instantiate four instances of an image with the dot and add them as subviews of the view you are decorating. you can then set the center of each dot on the center of each edge in the parent view. As long as clipping is turned off in the parent view, these will show up (if they are not hidden) even if they extend outside the frame of the parent view.

I don't understand what you want to accomplish by changing the background color in sections of the label view, but I this probably has some moderate complexity to it.

You can also to this with core graphics. I'll stop there, though. There are literally many ways to do what you are trying to do.

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