Category Archives: Steampunk Road

Set Title For State

This announcement brought to you by every dynamic UIButton with truncated text ever:

When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)

 

The Grumpy Old Programmer and MapKit

I really ought to rename my blog “The Grumpy Old Programmer”. Today I am going to pick on Apple and MapKit.

Now, MapKit had some issues at the start of its life. Fortunately, those are in the past. I have actually found MapKit to be an enjoyable experience so far. But I do have one issue with it that I just came across.

You can tell MapKit where you want your map centered and how tall it should be (in degrees latitude) and how wide it should be (in degrees longitude). MapKit will supposedly give you a map as close to what you requested as it can, but it can’t guarantee that you will get exactly what you asked for. This is because MapKit is going to fill the available space with the map while still maintaining the Mercator projection.┬áThe upshot of this is that a full-screen display can only display half of the earth at a time.

The Google Maps API will readily serve up not just the whole earth, but the whole earth repeated several times over. It does this by clipping off the poles and letter boxing the map to preserve the projection.

As an added twist, I really want a different center to the map based on orientation. For a portrait orientation, the default map at minimum zoom can be centered on (0, 0) and you will see everything of interest (in that hemisphere, anyway). But in landscape orientation, the discrepancies between the Northern Hemisphere and Southern Hemisphere become obvious. I would much rather see more of the northern land than the southern seas in this case.┬áThat’s the Earth’s fault, not Apple’s. But again, this is a non-issue with the Google Maps API.

Fortunately, there is only one time when I want to set the center and size of the map, and that is at startup. The rest of the time, I am going to preserve the last location and zoom level that the user set. So, my apologies to Asia and Australia. Perhaps someday the iOS version of Steampunk Road will show your your half of the world as well as mine.