Where can I find a good example code for playing iPhone?
Check out this thread: Does iPhone have open source games?
There are several open source projects as well as open source developments.
There are several complete sources of the game on Binpress -