Clear MKMapView's cache of tiles?

前端 未结 3 571
感情败类
感情败类 2020-12-30 14:15

I\'m working on an iPhone game that uses an MKMapView as the playfield. After only a couple of minutes of play the app inevitably starts to get sluggish and eventually crash

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-30 14:30

    Are you setting the reuse identifier on your annotation views? (This means the system can detach those views and only keep a small number of views in memory at once. It also increases scrolling performance, because scrolling will reuse the detached views.)

    Use this method to get an annotation view to be reused:

     - (MKAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier
    

提交回复
热议问题