ios - Google map in UICollectionView loading and scrolling issue -


i have implemented uicollectionview horizontal free (not pagination) scrolling. , every uicollectionviewcell loading real google map (image attached). currently, flickers on scrolling, need smooth scrolling , smooth loading of map.

what tried,

  1. i tried load google map in background , update cell in main ui thread crashes.

logs says: (sharedresourcecache_ != nil) false: shared resource cache not populated.

here code:

dispatch_async(dispatch_get_global_queue(int(qos_class_user_initiated.value), 0)) {                    var getmap = self.getmapviewforcell(cell, indexpath: indexpath)          dispatch_async(dispatch_get_main_queue()) {              cell.contentview.addsubview(getmap)         }     }  func getmapviewforcell(cell: cardcollectionviewcell, indexpath: nsindexpath) -> uiview {      let randomindex = getrandomnumber(0, maxrange: (latarray.count-1))      var camera = gmscameraposition.camerawithlatitude(getlatitude(randomindex), longitude:getlongitude(randomindex), zoom:16)     var mapframe = cell.mapview.frame     mapframe.size.height -= cell.name.frame.size.height     mapframe.origin.y = cell.name.frame.origin.y + cell.name.frame.size.height      var mapview = gmsmapview.mapwithframe(mapframe, camera:camera)     mapview.settings.setallgesturesenabled(false)      var marker = gmsmarker()     marker.position = camera.target     marker.icon = uiimage(named: "homeicon.png")     marker.map = mapview            mapview.tag = 99      return mapview } 

if can load google map in background can solve many issues, think. in advance advice?

google map loading on uicollectionviewcell, horizontal scrolling


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -