There is a very simple way to add "airplane mode" detection to your iphone application without writing any code. You need to add a new property to your Info.plist property file called "SBUsesNetwork", set its property type to "boolean", and check the box. This will cause the iPhone to immediately present the "Disable airplane mode or use local wifi" dialog when the application starts.
To add this property, bring up Info.plist in the property list editor. Then use the "+" to add a new property. Type in the name "SBUsesNetwork" into the new property name. Then right click (ctrl-click) this property name and change its type to "boolean". Then make sure it is enabled.
Now, you may want/need to add more network detection to your application. The "Reachability" example code on the iPhone developer site provides a nice utility to help you further detect network availability. In fact, this code will allow you to monitor the availability of a specific web site and it will let you know if the reachability status changes.