MapKit Tutorial: Getting Started

This app doesn’t have tabs, either :wink:

did you change the UIButton initializer in viewForAnnotation? at the end of // 3:

view.rightCalloutAccessoryView = UIButton(type: .DetailDisclosure) as UIView

did the detail button appear when you did just the David Kalakaua statue? before parsing the JSON file

also, did you set ViewController to be mapView.delegate, in viewDidLoad? if I comment out that line, I get the pin info, but no detail button.

Ah thank you Meister, you saved me. By some reason my line was like this:

view.rightCalloutAccessoryView = UIButton(type: UIButtonType.System) as! UIView

I must have changed it thinking about Swift 2. The correct, as you said is:

view.rightCalloutAccessoryView = UIButton(type: .DetailDisclosure) as UIView

The other aspects you mentioned are Ok. By the way, by any chance, do you know an easy way to change these Pins to figures? I’ll need it for my project!

https://www.raywenderlich.com/87008/overlay-views-mapkit-swift-tutorial

Man, this website gives me a headache! Reading through this “tutorial” is a nightmare. The author clearly understands programming but lacks the ability to teach. Instead of teaching and explaining what what’s going on there are smart-ass remarks like, and I quote, “OK, so the title, locationName and coordinate properties will be used for the MKAnnotation object, but what’s the discipline property for? You’ll find out later in this tutorial ;]” When I read this sentence and came to that snarky smily face I literally wanted to slap the author of this article. It’s like the author is giving me the big middle finger. How about you f*ing explain what the hell you’re doing?? Guess what’s in my head is the WORST method of teaching. It is very ineffective. Also, there’s the fact that the author starts bringing in other random shit that has nothing to do with the topic at hand in the case of “In this case, your ViewController will be the delegate for the map view. To avoid clutter and improve readability, you’ll create an extension of ViewController in a separate file.” What the fuck?? This isn’t a “ViewController readability” tutorial, or a “ViewController extension” tutorial. Leave that extra garbage that detracts from the focus of the article OUT of the article. Damn.

This article would be a LOT more effective if instead of taking a “here write this program I just wrote” approach it took more of a “here’s a concept, here’s the code to implement that concept, (here are some tips regarding this thing)”. Instead we are blindly following the author because the author’s ego is so big they can’t just explain the damn thing they have to present it in this convoluted, mindfuckery way.

Additionally, this is not the first article on this site that I have gone through that seems to be over complicated. All I’m saying is that I would NEVER pay for any of the content on this site because the way it is presented is asinine.

Relax man, if you don’t like the way it is presented here, you should search on another source, there are a lot of them! :smiley:
Btw, I’m not a team member or anything


Sorry to hear you don’t like the tutorial! Thank you for the various suggestions, we will keep them in mind.

Hey, this is a great tutorial. I have a question though. How can I put a radius circle around the User’s Location? I’ve been through all of the Map tutorials. Right now I have a radius around coordinates but it’s not the same. I want the radius to update when the user’s location does. Please help

try putting your circle code into mapView:didUpdateUserLocation:

https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapViewDelegate_Protocol/#//apple_ref/occ/intfm/MKMapViewDelegate/mapView:didUpdateUserLocation:

Hi, thanks for responding. I did that but it’s still not working. This is my first app and this is basically all I need to complete it. Please review my source code!

use the userLocation argument instead of creating a new location

It’s working now thanks! The only thing now is that the old radius circle stays after the user location’s change

You guys need to garbage all the old coded apps prior to xcode 7. Its a huge waste of time trying to get your apps to work with xcode 8.

Would it be possible to add your updated FINAL project to your link as follows:
Here is the final project with all of the code you’ve developed in this tutorial.

Hi,
I really like the tutorials in byte size format and it is easy to understand. With respect to the Mapkit, I am trying to change the annotation font size, color and other attributes. Do you have any tutorials on that? Going over the tutorial it appears you can create a custom class to do that. But I do not know how.
Appreciate if you can give me some pointers.

Thanks
Ramesh

thanks Ramesh!

do you mean something like this? ios - Custom font for MKAnnotationView Callout - Stack Overflow

I’ll see what I can do, although now it will have to be Swift 3 


Yes Swift 3, that would be great

ok, the link is in the tutorial, also here:

https://www.raywenderlich.com/wp-content/uploads/2015/03/HonoluluArt-Swift3.zip

It there a way to access the image file for the Honolulu public art into a JSON file? I want to create table view cell that displays an image view from the JPG file along with the description of the art work provided by the JSON file.

the image urls are just after the location name in the JSON file, so json[13].string

however, I’ve just tried one in Safari, and the image isn’t there anymore, although the original data.honolulu.gov data set hasn’t changed the urls.

the images are now on AWS, so you’d need to change the JSON file’s urls; for example:

“PastPerfect Online”

becomes

“https://s3.amazonaws.com/pastperfectonline/images/museum_220/001/193901-5.**jpg**”

note the https