UITableViewCell中的iPhone MKMapView [英] iPhone MKMapView in UITableViewCell

查看:104
本文介绍了UITableViewCell中的iPhone MKMapView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的UITableView的每个单元格必须显示一个带有内部注释的小型MKMapView. 我设法通过创建自定义单元格并在cellForRowAtIndexPath方法中配置其MKMapView来做到这一点.这些位置基于我之前构建的数组.

Each cell of my UITableView has to display a small MKMapView with an annotation inside. I managed to do this by creating my custom Cell and configuring its MKMapView in the cellForRowAtIndexPath method. The locations are based on an array I build earlier.

一切正常,但是每次我滚动UITableView时,MKMapView都会刷新. 这是缓存" MKMapViews的一种方法吗?

Everything works fine but the MKMapViews refresh everytime I scroll the UITableView. Is ther a way to "cache" the MKMapViews ?

谢谢

推荐答案

您可能不应该在cellForRowAtIndexPath中配置地图视图,而是配置它们并将它们存储在viewDidLoad或awakeFromNib中的数组中.然后只需在cellForRowAtIndexPath中设置单元格的地图视图即可.

You probably shouldn't be configuring the map views in cellForRowAtIndexPath, instead configure them and store them in an array in viewDidLoad or awakeFromNib. Then just set the cell's map view in cellForRowAtIndexPath.

这篇关于UITableViewCell中的iPhone MKMapView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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