像iPod app一样使用UITableView气泡/标注 [英] Use UITableView bubble/callout like iPod app

查看:68
本文介绍了像iPod app一样使用UITableView气泡/标注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone 4(iOS 5.0.1)上的音乐"应用程序中的一首歌曲上发现了一个轻按气泡/带有长按手势的标注.

I found a light bubble/callout with a long press gesture on a song in my Music app on iPhone 4 (iOS 5.0.1).

有人找到它了,可以帮助我在其他表格视图中添加此功能吗?

Does anyone found it and can help me to add this feature on other table view ?

推荐答案

好的,这很简单,但前提是您对iOS编程有一定的了解.绝对的第一步是设置您的应用程序以接收所谓的手势识别器.

Okay This is quite simple but only if you have a little experience with iOS programming. The absolute first step would be to setup your app to receive what is called a gesture recognizer.

在这种情况下,该手势称为UIGestureRecognizer的子类"UILongPressGestureRecognizer"."UILongPressGestureRecognizer"具有四个可以设置的属性:

minimumPressDuration

numberOfTouchesRequired

numberOfTapsRequired

allowableMovement

有关更多详细信息,请参见类参考链接: http://developer.apple.com/library/IOs/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.html#//apple_ref/c/econst/UIGestureRecognizerStateBegan

In this case the gesture is called "UILongPressGestureRecognizer" a subclass of UIGestureRecognizer. The "UILongPressGestureRecognizer" has has 4 properties you can setup:

minimumPressDuration

numberOfTouchesRequired

numberOfTapsRequired

allowableMovement

For more detailed information see the class reference link: http://developer.apple.com/library/IOs/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.html#//apple_ref/c/econst/UIGestureRecognizerStateBegan

要查看其他人如何实现手势,请参见以下链接:UILongPressGestureRecognizer按下时会被调用两次

To see how others are implementing the gesture see this link: UILongPressGestureRecognizer gets called twice when pressing down

现在,在设置好接收手势之后,您需要做的就是显示一个视图,在该视图中,您可以放置​​一个像iPod app一样的标注气泡,也可以放置任何您喜欢的东西.

Now after you have setup to receive the gestures all you need to do is display a view, within that view you could place a callout bubble like the iPod app or you could place anything you like.

如果视图始终位于您可以在Xcode中执行的某个位置,则只需设置一个小视图,将其设置为隐藏即可,当手势被识别后,您就可以为该视图设置动画,就像iPod App一样.

If the view will always be in one location that you can do this in Xcode, just setup a small view, set it hidden and when the gesture is recognized you can animate the view to turn on just like the iPod App.

如果要在用户手指触摸屏幕的地方弹出视图,则需要做更多的工作来检测用户在屏幕上触摸的位置.从那里开始,您将使用该位置来分配UIView.

If you want the view to pop up where the users finger touches the screen, then you will need to do a little more work to detect where on the screen the user touched. From there you would use that point location to alloc a UIView.

现在,如果您在此之前进行编程,则应该可以轻松设置,如果需要更详细的说明,请告诉我.

Now if you programmed before this should be somewhat easy to setup, if you need a more detailed explanation let me know.

这篇关于像iPod app一样使用UITableView气泡/标注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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