Changes

Jump to: navigation, search

An Example SQLite based iOS 4 iPhone Application

1 byte removed, 20:24, 19 January 2011
Designing the User Interface
The last step involves connecting the two buttons to the corresponding actions. First, display the Connections Inspector (''Tools -> Connections Inspector'') then select the Save button in the view window. Click inside the small circle next to the Touch Up Inside event in the Connections Inspector window and drag the blue line to the ''File’s Owner''. To establish the connection, select saveData from the resulting menu. Repeat these steps to connect the Find button to the findContact action before saving the design and exiting Interface Builder.
21.10 == Building and Running the Application==
The final step is to build and run the application. Click on the Build and Run button located in the toolbar of the main Xcode project window. Assuming an absence of compilation errors, the application should load into the iOS Simulator environment. Enter details for a few contacts, pressing the Save button after each entry. Be sure to check the status label to ensure the data is being saved successfully. Finally, enter the name of one your contacts and click on the Find button. Assuming the name matches a previously entered record, the address and phone number for that contact should be displayed and the status label updated with the message “Match found”:
[[Image:ios_4_iphone_sqlite_app_running.jpg|An iOS 4 iPhone SQLite based application running in the iOS Simulator]]
 
== Summary ==
In this chapter we have looked at the basics of storing data on an iPhone using the SQLite database environment. For developers unfamiliar with SQL and reluctant to learn it, an alternative method for storing data in a database involves the use of the Core Data framework. This topic will be covered in detail in the next chapter entitled [[Working with iOS 4 iPhone Databases using Core Data]].

Navigation menu