BuySellAds.com

My book Barcodes with iOS 7 is nearing completion. Buy it now to get early access!
Our DNA is written in Objective-C
Jump

Stuff you learn from reverse-engineering Notes.app

I’m adding note taking to iWoman 2.0 and so I was thinking which metaphor would be one that users would understand and like. So I decided to mimic the look and feel of the built-in Notes app.

There where quite a few interesting things I had to learn and figure out and in this article I am going to share them with you. These are techniques that you can use in many other scenarios besides of making your own Notes view controller.

I was clear from the start that I needed to use a UITextView for the editing itself. Notes.app has several specialities that we have to figure out if we want to capture the look.

  • Font is Marker Felt Thin, Size 19.
  • each line sits on top of a grayish blue horizontal line
  • the text view has a padding at all sides, something that the standard UITextView does not give us
  • There is padding at the top, but still the text goes up to the corner
  • the horizontal lines move together with the text and never end towards the bottom
  • two static vertical brown lines line up with markings at the top and the bottom
  • the body of the notes is not just a yellow gradient, but has some structure and speckles
  • scrolled text disappears behind the images for the top and bottom edge
  • The text view needs to be dynamically resized when the keyboard appears or disappears to prevent hiding of text.

Those where the challenges, in this YouTube video you see my solution and an overview of how I achieved it. More in-depth reasoning you find below.

Read more

Timing is Everything

zeke817 asks:

Hey guys just wondering how to put a timer in the appdelegate. I need a timer to keep playing on through multiple views instead of just playing on 1 view. Any help apperciated

Using timers is pretty simple. There are plenty examples around and it’s not difficult to understand. Having said that, I am responding to this question for three reasons:

  1. my posts on my blog have been pretty scarce recently due to lots of programming for customer projects
  2. I think I should at least document how I am using timers so that I can refer people to this post when the question arises again and again.
  3. Explaining a simple thing to somebody else is the best way to train clarity in teaching.

Generally speaking timers are not instantiated but scheduled. The difference is that the SDK/OS takes care of their memory management and we only have to worry about whether or not we want them to fire. So we don’t need to ever release a timer, instead we invalidate it.

Read more

Filtering Fun with Predicates

Being present longer than iPhone OS exists on the Mac platform NSPredicate was only introduced to us iPhone developers in Version 3.0 of the SDK. They have multiple interesting uses, some of which I am going to explore in this article.

You will see how you can filter an array of dictionaries, learn that the same also works for your own custom classes. Then we’ll see how to replace convoluted IF trees with simple predicates. We’ll explore how to use predicates to filter entries of a table view and finally peek into the inner workings of predicates.

Being simple and powerful at the same time it took me 3 hours to write this article. I hope you don’t give up halfway through it, because I promise it will be a great addition to your skillset as iPhone developer.

Read more

Directories: Temp, Cache, Documents

The first thing to learn when starting to persist data onto the iPhones solid state drive is that all apps have their own sandbox. Contrary to other operating systems where you have a shared documents folder, you have several directories for each individual apps. Now on the iPhone these sandbox directories all get a GUID in their name, so you have no way to hardcode or guess the real path they will end up on.

Luckily there is a method of getting the path for those directory, which I wrote about about a year ago: Getting Standard Paths. Today I will elaborate a bit on what I learned since then, it turns out that this is only half the story and as intermediate programmer you will want to use the correct kind of folder for each task.

Read more

Dr. Touch #014 – "Bonjour"

The iPhone and Apple News have never been as sexy … Jean Francois Martin sits in for speechless Oliver and provides a French twist.

This episode is brought to you by:

Dr. Touch’s Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support by Dr. Touch himself. Check it out today!

Play

The Show Notes (aka Script) below the break…

Read more

Not for the Money

I learned a lesson today regarding happiness and programming. If you are concentrating on a single device and/or a niche of applications then often you feel like you’re the only one you loves the outcome of your never ending pecking at keys. And if you DO get feedback for your apps then often it’s only a rant in the reviews.

I already told you the story how SpeakerClock came to be. I did not write if for the money because frankly I did not think that anybody but myself would be using it. That’s also the reason why I am offering it for FREE initially. I’d rather get a couple of people to use it and send my feedback than have it sit on a virtual shelf collecting dust. Version 1.1 will be the one where I start charging, I decided. Or maybe the basic features now present will stay free, but some upgrades could be a good InAppPurchase.

I’m going to have a look at what we can learn about making great apps from an unexpected reaction I received.

Read more

iPhone Landscape Stands – Cheap or DIY

After having released SpeakerClock, a speech countdown clock, I got a couple of suggestions, one was not about the app itself, but about how you could stand the iphone on it’s side.

Kevin Jamison: “Now we just need to come up with a simple little stand similar to the iPod Touch uses to hold it in a tilted landscape mode. Maybe rubber coated feet so it won’t slide if you are using a podium.”

I remembered that every once in a while the blogosphere brought to light yet another clever way of solving such problems. A quick search on Google and YouTube yielded a couple of great solutions. Some that you can purchase , same that you can make yourself at little to no cost.

First let’s look at the professional solutions which typically cost between $5 and $10. After we’ve set the benchmark we’ll explore how we can achieve landscape stability ourselves. Building something useful out of physical things might be a welcome distraction from hours of coding Cocoa. :-)

Read more

SpeakerClock 1.0

I like to watch the TED Talks, it’s always something novel and instructive and makes me believe that the world is generally moving towards a brighter future led by a handful of rather bright fellows.

Now one thing these guys do extremely well is to give a TALK. Through experimentation it was found that at that length the speaker is forced to condense his message and be as clear as possible to get his point across. This constraint is enforced by the famous TED speaker LED clock. (It’s actually a countdown and not a clock, but people seem to prefer using the word “clock” over “countdown”)

This is a countdown at the edge of the stage which at a glance shows you what your remaining speaking time is. Also there is a traffic light of sorts. Shortly before the end of the time a green light switches to yellow to signal that you have to start wrapping up your message. Red means that it’s time for the closing remarks.

Obviously there are dedicated devices out there which aim to fill exactly the same need of visualizing a speakers time constraint. And of course there are a couple of iPhone apps providing this functionality. My second choice of the name of my app was taken by Talk Timer. Yet another is Speech Timer Free which provides the traffic light and the Premium version of it even allows for exporting of your speaking log.

I might continue to wish I were a great and inspirational speaker, but in the meantime one thing that I CAN do is make such a countdown clock for iPhone. I just had to do it, because the thought of the clock kept popping up in my head and kept distracting me from other projects.

My goal for SpeakerClock was this:

  • emulate the famous TED clock as closely as possible
  • use big red LED numbers (for which I had invented DTLEDNumberView)
  • allow for all customization and setting via touch gestures, all on the main screen
  • use the second page solely to showcase DTAboutViewController

Version 1 uses the maximum size possible of the digits that is available in landscape mode. Because of this you can see the digits from several meters away which is necessary if you want to position it so that you can move freely while giving your speech. To maximize the size of the clock I had to move minutes and seconds closer together and wrap the traffic lights underneath.

I made it a special point to finish the app within a single day and so I left out several things which I can put it if there is any interest in this app at all. The art of 1.0 is to concentrate on the required core features and leave some of your brilliant ideas for future versions. Here are some ideas still on my mental drawing board:

  • German localization (and other major languages) – language is not critical to understand usage of the clock all texts are on the instructions and about pages
  • Multiple Presets – might be an idea for a freemium upgrade
  • Recording of speaking logs, summing up your total speaking time, exporting, sharing …

I made a YouTube video to demonstrate the app:

I sent the app to Apple yesterday. SpeakerClock will be available on the app store initially for free to get user feedback.

UPDATE: 2 days after submission SpeakerClock is now available on the app store.

Things I learned implementing my first InAppPurchase

Yesterday I sent my first app off to Apple containing an InAppPurchase (IAP). It’s a free app that gives the user an option to pay a dollar for a premium features. That’s what they call Freemium these days. Free to try, premium to get some more.

The possibility for Freemium was only introduced in October 2009 when Apple finally gave in to developer’s wish to be able to do away with those dreaded Lite versions which have a very low conversion rate (about 1%) anyway. Until that time IAPs where only available for paid apps.

After developing on the premium content for about two weeks I hit my first roadblock. You apparently cannot configure an app id for use in a provisioning profile it it is already configured on another developer’s account.

If you are looking for a full walkthrough, this is not the article to provide that. Troy Brant has the most complete IAP Walkthrough on his blog. Instead this is a summary of my mental notes.

Read more

Dr. Touch #013 – "Long Stretch"

It’s just a couple more weeks until the first iPads hit the store. Still there are a couple of interesting news items that we shall explore. In this episode my guest is Barbara Gavin who organizes the Voices that Matter iPhone Developer’s Conference.

This episode is brought to you by:

Dr. Touch’s Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support by Dr. Touch himself. Check it out today!

Play

My Show Notes (aka Script) below the break…

Read more