Im developing ipad app and looking memory using good all viewcontrollers but my MapDetailViewController gives me Received memory warning how can i resolve it .
All viewcontrollers use my app max 34.MB memory but MapDetailViewController using 100 MB More. My codes under below what is wrong ?
import UIKit
import MapKit
class MapDetailViewController: UIViewController,MKMapViewDelegate {
@IBOutlet var mapView:MKMapView!
@IBOutlet weak var mapArea: DesignableView!
@IBOutlet weak var nameSales: DesignableLabel!
var showmapListcomming = String()
override func viewDidLoad() {
super.viewDidLoad()
// Show Map
let myString: String = showmapListcomming
var myStringArr = myString.componentsSeparatedByString(",")
nameSales.text = myStringArr[0]
let annotation = MKPointAnnotation()
let latitude:CLLocationDegrees = (myStringArr[1] as NSString).doubleValue
let longitude:CLLocationDegrees = (myStringArr[2] as NSString).doubleValue
let latDelta:CLLocationDegrees = 150
let lonDelta:CLLocationDegrees = 150
let span:MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lonDelta)
let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
let region:MKCoordinateRegion = MKCoordinateRegionMake(location, span)
mapView.setRegion(region, animated: false)
annotation.coordinate = location
annotation.title = myStringArr[0]
annotation.subtitle = "User"
mapView.addAnnotation(annotation)
}
// MARK: - MKMapViewDelegate methods
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let annotationView = MKPinAnnotationView()
return annotationView
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}