在 OpenFlow 之上浮动 UILabel
如何让 UILabel 漂浮在 Alex Fajkowski 的 CoverFlow 实现(称为 OpenFlow)之上?
好吧,我已经弄清楚了。我只需将 BringSubviewToFront 与 UILabel 一起使用。
感谢所有回答的人。
How do you get a UILabel to float above Alex Fajkowski's implementation of CoverFlow called OpenFlow?
Ok I've figured it out. I just had to use bringSubviewToFront with the UILabel.
Thanks to everybody who answered.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
创建一个
OpenFlow
实例和一个UILabel
实例子视图,作为父view
的子视图,使用-insertSubview:atIndex 将标签放置在流视图之上:
、-addSubview:
或类似的例如:Make an
OpenFlow
instance and aUILabel
instance subviews of a parentview
, placing the label atop with flow view using-insertSubview:atIndex:
,-addSubview:
or similar e.g.:要回答第二个问题,请尝试以下操作:在 IB 中编辑 AFOpenFlowView 并将标签视图添加为该视图的子视图,无论您希望它出现在哪里,然后如果您不希望它出现,则将视图上的属性设置为隐藏默认。在控制器中为标签视图创建一个 IBOutlet,以便您可以轻松地操作它,例如将隐藏设置为显示以便显示它。我不熟悉开放流程,所以我不确定它是否会以编程方式创建一个子视图来遮挡您的标签。如果是这样,您可能需要使用 UIView 方法使用插座将其移动到前面。
To answer the second question, try this: edit the AFOpenFlowView in IB and add the label view as a subview of that wherever you want it to appear, then set the attributes on the view to Hidden if you don't want it to appear by default. Create an IBOutlet for the label view in your controller so you can easily manipulate it, such as setting hidden to show in order to show it. I'm not familiar with open flow so I'm not sure if it will programmatically create a subview that will obscure your label. If so you may need to use the outlet to move it to the front using UIView methods.
Openflow 示例代码对此进行了完美演示。 Alex 使用界面生成器在 openflow 视图的右上角添加了一个信息按钮。这正是您所要求的。
我想补充一点,如果您无法理解示例代码中发生的情况,您应该查看 Apple 演示简单 UIView 用法的更多代码示例。
The Openflow example code shows a perfect demonstration of this. Alex adds an info button in the top right of the openflow view using interface builder. This is exactly what you are asking for.
I would add that if you can't understand what is going on from the example code, you should look at more code examples from Apple demonstrating simple UIView usage.
这并不容易,因为每张图片的标签名称都必须更改。我们必须使用索引,并使用事件..移动..点击..选择...我也在努力!
It's not so easy because the label name has to change for each picture. We have to work with index, and with event.. move.. tap.. selected...I'm working on too !