私のios swift
アプリでは、私はUITableViewController
のセルを動的に追加しました。各セルにはMKMapView
が埋め込まれており、各セルのマップの中心を別の座標に設定しています。私は、このメソッドを呼び出すことによって、そうやってる:cellForRowAtIndexPath
内部UITableViewControllerの各セルには、マップが埋め込まれています。代わりに地図のスクリーンショットに変更する方法はありますか?
func centerMapOnLocation(location: CLLocation, map: MKMapView, radius: CLLocationDistance) {
let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate,
radius * 2.0, radius * 2.0)
map.setRegion(coordinateRegion, animated: true)
}
:
override func tableView(tview: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tview.dequeueReusableCellWithIdentifier("cell") as! SingleCall
let user:SingleUser = self.items[indexPath.row] as! SingleUser
let regionRadius: CLLocationDistance = 150
let initialLocation = CLLocation(latitude: user.coordinate.latitude, longitude: user.coordinate.longitude)
centerMapOnLocation(initialLocation, map: cell.eventMap, radius: regionRadius)
cell.eventMap.zoomEnabled = false
cell.eventMap.scrollEnabled = false
cell.eventMap.userInteractionEnabled = false
}
これは罰金であり、それは動作しますが、私はたくさんのレコードを想像メモリに問題があるでしょう - 今もユーザーがテーブルをスクロールしたときにカップルのセルのみが表示されます。各マップは即座に読み込まれ、計算に要する計算量を想像することができます。
私の質問は、地図の実際の位置を多分スクリーンショットのようなものにダイナミックマップビューを変更する方法はありますか?それは多くの細胞になると速く働くでしょうか?