/dev/trouble
Eric Roller's blog

Wednesday, February 22, 2012

Fixing web site presentation for iOS

For a while now, I have been puzzled by the fact that Mobile Safari, the iOS version of Safari, opened any page on my web site at a much larger width than the CSS value for the main content area (570px).

It turns out, there are a number of Apple-Specific Meta Tags that can be used to provide background information for your web page, like how to scale it, or providing scaling limits.

To set the initial scaling of a window when presented on the iPhone or iPad, there is the viewport meta tag. If missing, a default width of 960 pixels will be used, or more if the web content is wider. Setting it to 590 pixels, thus adding a 10 pixel padding, works just fine for my particular case:

<meta name="viewport" content="width:590px">

Saturday, February 18, 2012

Opening hours in Open Times iPhone app

For years, I have had a constantly growing list of shop opening hours in my notes on my iPhone. There has never been a proper place to put them. Until now.

The Open Times iPhone app makes it simple to store all my shop opening times and it is flexible enough to handle any custom combination of when a shop opens and closes (or is open for 24 hours). Best of all, the business hours are presented graphically in a calendar-like view which is an intuitive way to check which of the shops are currently open or closed.

Now that I have entered my data into the app, I have confidently deleted that long entry from my notebook. Success!

Monday, January 16, 2012

Custom UILabel Fonts on the iPhone Simulator

Wasted a couple of hours debugging an issue with the use of a custom font on a UILabel; the text simply wouldn’t show up on the iPhone Simulator.

No such problems with the (bold) system fonts of any size.

As it turned out, this is an issue (bug) with the iPhone Simulator; when running it on a device, the label is shown correctly.

Also note that there is a “fonts” app and an iOS fonts website that show all the fonts that are available on the iPhone or iPad.

Friday, December 16, 2011

Getting Photos on the iPhone Simulator

I have been wondering how to get any pictures onto the iPhone simulator for ages and have thought one would need to sync it with iTunes.

But no, I stumbled over the solution by accident: One simply uses Safari on the iPhone Simulator to navigate to an image and the uses the built-in controls to save it.

Hint: to navigate to an image that you have open in your browser on your desktop, simply drag and drop the image (or the URL) to the iPhone Simulator. The same works for any image in the Finder!