No Map Icon - Solved


Beginning Chapter 6, I deleted Map View Controller and added the necessary code to MapViewController.swift but I can’t seem to access or view the map when I run the app. All I have on the tab bar is “Convert”. What am I missing? I’ve checked my code many times and I’m not getting any errors or warnings. Here is my code:

The issue I had here was caused by deleting the Map View Controller instead of the Map View. Recreating the Map View Controller straightened everything out. Thanks for your patience, I’m a noob

import UIKit
import MapKit

class MapViewController: UIViewController {
    var mapView: MKMapView!
    override func loadView() {
        // Create a map view
        mapView = MKMapView()
        // Set it as *the* view of this controller
        view = mapView
        let segmentedControl = UISegmentedControl(items: ["Standard", "Hybrid", "Satellite"])
        segmentedControl.backgroundColor = UIColor.whiteColor().colorWithAlphaComponent(0.5)
        segmentedControl.selectedSegmentIndex = 0
        segmentedControl.translatesAutoresizingMaskIntoConstraints = false
        let topConstraint = segmentedControl.topAnchor.constraintEqualToAnchor(view.topAnchor)
        let leadingConstraint = segmentedControl.leadingAnchor.constraintEqualToAnchor(view.leadingAnchor)
        let trailingConstraint = segmentedControl.trailingAnchor.constraintEqualToAnchor(view.trailingAnchor)
        = true = true = true
    override func viewDidLoad() {
        //Always call the super implementation of viewDidLoad
        print("MapViewController loaded its view.")


I am having the same problem - can’t see the map nor the map in the tab bar.

Have you solved this yet?

I am new to programming as well.


Yes, you did solve it. Sorry. I will attempt to fix it.

Fixed! Moving on.