Search code examples
iphonemkmapview

iPhone MKMapView in UITableViewCell


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.

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

Thanks


Solution

  • 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.