UITableView 实现“如何” (就像 iPhone 上的 Twitter 应用程序一样)
我正要实现一种表格视图行为,就像 iPhone 的 twitter 应用程序的某个部分中使用的表格视图行为一样,确切地说,我正在谈论当我在地理本地化推文中点击推文下方显示的位置时显示的表格视图。 。 .这里有一些图片仅供参考:
如您所见,表格视图下方有一个背景(实际上是地图),但它不仅仅是一个背景 UIView(或 Mapview),因为表格视图将其上下拉动和她自己如果滚动即将“弹跳”。 。 .它当然不是节页眉/页脚,因为表格漂浮在其上。 。那么,您对如何实现该表视图有什么想法吗?可以是网页视图吗?
编辑:我找到了解决方案并将其发布下来
I was about to implement a table view behavior like the one used in a certain part of the twitter app for iPhone, precisely I'm talking about the tableview shown when, in a geolocalized tweet, I tap on the location displayed under the tweet. . .here's some pictures just to give it a look:
as you can see the table view has a background beneath (actually the map), but it is not just a background UIView (or Mapview) because the table view pulls it up and down with herself if the scrolling is about to "bounce". . .and it is certainly not a section header/footer, because the table floats on it. . .so, do you have any ideas on how to implement that table view? Could it be a webview?
edit: I found a solution and posted it down
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需将表格视图和地图视图添加到滚动视图中即可。
just add the tableview and the mapview to a scrollview and you should be all set.
也许你可以使用 UIView 动画。
您可以在与表格视图相同的高度添加地图视图,但在界面生成器中将其 alpha 设置为 0。
之后,您可以在 IBAction 方法中执行以下操作:
这应该可以!
或者您可以在 (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath: 中尝试类似的操作
并加载 Google 地图请求,或者直接将您的地图视图放入单元格中,还没有尝试过。
Maybe you can use UIView animations.
You add a mapview at the same height as your table view but with its alpha set to 0 in interface builder.
After that you can do as follow in your IBAction method:
This should do it !
Or you can try somthing like this in your (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath:
And load a Google Maps request or maybe put directly your mapview in your cell, haven't tried that.
看一下 Three20 库。
http://third20.info
并从 github 下载源代码 https://github.com/facebook/third20
在此框架中,有一个名为 TTTableViewController 的类,它实现了 TTTableViewDragRefreshDelegate。
此外,还有一个使用此类的示例应用程序 TTTwitter!
您可以从它开始并子类化来实现您需要的所有功能!
Take a look at three20 library.
http://three20.info
and download source code from github at https://github.com/facebook/three20
In this framework there is a class named TTTableViewController that implement TTTableViewDragRefreshDelegate.
More, there an example application TTTwitter that use this class!
You can start from that and subclass to implement all features you need!
好吧,我刚刚想通了。 。 .这太容易了。 。一切都是关于使用 tableview 第一行,必须隐藏该行以显示底层图像,以及当拖动方向向下时必须使用 tableview 向下拖动底层图像的滚动视图委托。 。 .这里有一个xcode项目供你尝试一下:)
http://cl.ly/9bje
Ok I just figured it out. . .it was easy as hell. . .and was all about playing with the tableview first row, that has to be hidden to show the underlaying image, and the scrollview delegate that has to drag down with the tableview the underlying image when the dragging direction is down. . .here is the xcode project for you to give it a try :)
http://cl.ly/9bje