PDA

View Full Version : Some queries about iPhone application development




masumbuet
Dec 7, 2008, 05:00 AM
I have the following questions about iPhone application development.

1. Does it make any distinction from the perspective of an iPhone network application whether the iPhone is using 3G or Wi-Fi for network support? If yes, then what are the differences from application development perspective?

2. What happens when my application running on the iPhone is interfered by an incoming phone call? My running application terminates or runs in the background allowing the reception of the phone call or anything else?

3. How to add "Previous" and "Next" keys on iPhone's default keyboard and their functionalities?
4. How to dynamically reduce the View size to make place for the keyboard appearance and prevent elements at lower portion of the View from being hidden beneath the appeared keyboard?

5. Which approach is better for building a View:
1. Use a nib file
2. Create the view dynamically in initWithFrame:

and why? Is it possible for a View that is initialized by a nib file to reduce its size?

6. How to determine that a UITextField has become the firstResponder (currently selected) just now?

7. If I use a navigation controller and push a view in it, the back button is automatically added to top left corner with the title of the previous View. How can I make the title "back" instead of the "Previous View title"?

Thanks in advance.



rendezvouscp
Dec 7, 2008, 06:18 PM
Alright, hereís my best go at all of your questions.

1. Does it make any distinction from the perspective of an iPhone network application whether the iPhone is using 3G or Wi-Fi for network support? If yes, then what are the differences from application development perspective?
Iím not sure what you mean by this question. You can detect whether the iPhone is on a Wifi network or the service providor's network.
2. What happens when my application running on the iPhone is interfered by an incoming phone call? My running application terminates or runs in the background allowing the reception of the phone call or anything else?
The application is sent events when the phone interruption starts and ends. I donít believe that you can do anything during the interruption, just at the start and end of it. Remember that your application might be in use during a phone call as well.
3. How to add "Previous" and "Next" keys on iPhone's default keyboard and their functionalities?
I donít quite know the answer to this one. I presume youíre talking about the mini toolbar that you see in Safari with the previous, next, and done buttons. Sorry!
4. How to dynamically reduce the View size to make place for the keyboard appearance and prevent elements at lower portion of the View from being hidden beneath the appeared keyboard?
Changing the frame size FTW.
5. Which approach is better for building a View:
1. Use a nib file
2. Create the view dynamically in initWithFrame:

and why? Is it possible for a View that is initialized by a nib file to reduce its size?
I use nibs for almost everything, especially if I can reuse it across the application.
6. How to determine that a UITextField has become the firstResponder (currently selected) just now?
Implement UITextFieldís textFieldDidBeginEditing: delegate method.
7. If I use a navigation controller and push a view in it, the back button is automatically added to top left corner with the title of the previous View. How can I make the title "back" instead of the "Previous View title"?
Check out the backBarButtonItem for the navigation item that belongs to the view that is the back button. I havenít ever tried to change it, but that should work. [P.S. You should have a really good reason for changing it. Really good.]

Hopefully that helps you a bit!

firewood
Dec 7, 2008, 07:28 PM
2. What happens when my application running on the iPhone is interfered by an incoming phone call? My running application terminates or runs in the background allowing the reception of the phone call or anything else?

If an incoming phone call is rejected, your app runs in the background while it is being rejected. If the call is accepted, your app is terminated (and will be killed if it refuses to terminate).


.

drivefast
Dec 8, 2008, 01:04 PM
1. Does it make any distinction from the perspective of an iPhone network application whether the iPhone is using 3G or Wi-Fi for network support? If yes, then what are the differences from application development perspective?

if you're asking if it makes any difference for an app whether the connection si 3G or wi-fi or whatever, generally the answer is "no": your app connects to the same internet ;) of course the connection speed varies. if you ask whether you can make the distinction between the two, the answer is "yes".


2. What happens when my application running on the iPhone is interfered by an incoming phone call? My running application terminates or runs in the background allowing the reception of the phone call or anything else?

while the phone is ringing, your application execution is suspended; some of the events are queued, some others are dropped. if you decline to answer, your application continues the execution from the point it was left, and processes the events in the queue. if you answer the call, your application will terminate gracefully (i.e. the applicationWillTerminate() function will get called, and you can add your stuff in there to save the current app state). you may use the saved state next time you start the app. i forgot whether the app is automatically restarted at the end of the call or not.


3. How to add "Previous" and "Next" keys on iPhone's default keyboard and their functionalities?

you cant add or change buttons on the keyboard, but you can select from a few different keyboard types. however i'm affraid this is not what you asked.


4. How to dynamically reduce the View size to make place for the keyboard appearance and prevent elements at lower portion of the View from being hidden beneath the appeared keyboard?

you may want to push up the view to make room for the keyboard, in case the field that you want to edit would otherwise get covered.


5. Which approach is better for building a View:
1. Use a nib file
2. Create the view dynamically in initWithFrame:
and why? Is it possible for a View that is initialized by a nib file to reduce its size?

nibs are generally easier to work with, in case you change your mind frequently about the layout. however, figuring out how to make all the connections with the code is not really intuitive for a beginner. i remember i was really frustrated when i started using the IB, and on a few occasions i gave up and reverted to implementing everything in code. once you learn how to use the IB, you will prefer nibs.

good luck.