How to create a database In iPhone application? - iphone

I have a very simple application, and i want to add into it a database. For all of you, to understand what i mean, it should look similar like default application "Contacts" in iPhone. It should contain list of elements (like people names in contact list), and when the user click name, the next view appear, which contain information about contact (and other buttons as well). All of data must be inside of application (not downloading from web pages).
Please help me! I am novice, and i have no clue what i should looking for, not just an array i guess... i will gratefully accept any of advice and links to examples, related to my problem.
PS. My app is not about contacts, its about diet. For example, it should look like: user click element "cheese" in list, and then next view provide information about product (calories, protein, fat etc.)

Take a look at the following free lessons from iTunes U. Paul Hegarty is an excellent teacher. These are dense so I had to watch a couple times, but everything you need is here:
Basic Persistence:
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/285
Core Data (Lecture):
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/287
Core Data Demo:
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/289
These pages have the pdfs, but go to iTunes and download the full lectures for an excellent overview. Also don't miss the CoreDataTableViewController available on the last linked page - handy.
Without this course I would not be an iOS developer, so I can't recommend it highly enough.
Enjoy,
Damien

Related

Joomla1.5 CRUD extension tutorial

I need to build a basic CRUD joomla extension for a customer.
On the user's side, it must display a product list when the user choose a category, and the product details when an item is selected in the list. On the product details page, the user can send a message to the site's owner regarding the chosen product.
On the admin side, user must be able to add/modify/delete products and categories. That's about it.
Does anybody knows (a) good tutorial(s) that could help me get started with this project?
I've worked with php 4 years ago and have 5+ years experience in web development (.net), but i'm new to joomla.
Thanks in advance!
Sounds like to me you are looking for an e-commerce extension with a catalog mode (no purchases/no cart enabled) and an Ask a Question form on product pages. I know that at least Virtuemart has this ability exactly. I am sure there are other simpler carts that will also accommodate your need. http://extensions.joomla.org/extensions/e-commerce/shopping-cart
Spend a couple of hours trying out carts, no code writing required.
A great place to start is the Joomla docs site.
Checkout Component Development section.
Also, here is MVC Component Tutorial (there are 6 section to it, look for links at the bottom for "Next"), it will definitely put you on the right track. You will have to add a lot of your project specific things and do out of the box things, but it should be pretty easy.
Just keep things separate to make it easier
View/Template - your presentation
Controller - logic
Model - Data Access Layer (DAL)

Simple Core Data Example App?

I am trying to learn about core data on the iPhone, and I am looking for a simple Core Data example app.
The problem is, all the example apps I've seen are either too simple (just one view and one data object), or so full of extra functions that it's hard to see what's relevant (Apple's example apps).
I'm looking for an example app with:
an ordinary cascading to-many relationship (e.g. Company > Departments > Employees)
a simple drill-down interface (e.g. click on a company to see list of departments; click on a department to see list of employees; click on an employee to see name and address)
simple editing (press plus for modal view to add company/department/employee)
... so I can learn the basics about passing contexts between views, NSFetchedResultsController etc.
Does anyone know of such a thing?
Thanks!
Try the example found here: Wiley Code Examples
Click on Chapter 18 - Downloads.
Hope this helps.
Let It Be Known
I would recommend Marcus Zarra's Core Data book and the examples therein. He takes one example app that starts off very simple and incrementally adds complexity.
RecipeCT is the project that I would suggest looking at first. Having the book would help you navigate from project to project as the basic Recipes app transforms.

iPhone example to go through

Can you provide me a basic iPhone example which has the following;
a. It is primarily a navigation-based app (Top-level view, Detail view, etc)
b. It also uses table (to present list of items, item details, add, edit, delete)
c. It uses Core Data for storing the list items
d. Optionally, it would be really great if it uses an API for retrieving some of the table data (otherwise user entered if API does not return).
While I do have individual examples for all these thing, I ma basically looking for an example which kind of combines all these things into a single app.
I have already gone through some of the IOS developer reference and hence would want other combined examples.
Any reference examples would be highly appreciated.
Thanks a lot.
Have you looked through the iOS Sample Code library? You'll find examples of all these. They have TopSongs (API, Navigation Views, Table Views, Core Data) and CoreDataBooks for Core Data.
If you create a project using the Navigation based template and select "Use Core Data" you will get the skeleton of exactly the type of app you want.
Examples covering all of those are on Apple's developer website, developer.apple.com.
I used this one is one, to learn this: http://icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/#create-db

iPhone SDK: Ideas on how to implement a help facility for application

We we wondering what are some ways developers have added a help function to their apps. What are some techniques people have used?
One way we were thinking of is to us UIWebView to display a HTML file with help instructions.
Thoughts appreciated.
I'm using UIWebView right now which pretty much contains all the help in a single page, along with some JQuery things to display popups, etc. But I like the way iCab Mobile (et al.) are doing things which is a sectioned UITableView with each row a separate topic or section within their overall help information (complete with icons...) then in their bundle they have each section in its own html file, organized by localization.
Another thing in my queue for the next release is to provide a dynamic "News" view. The rough idea is as follows... I have on my server a file or CGI where I can place small bits of news I'd like to push out to users. On startup, my app checks for network availability and if present, start a thread to see if anything has changed on the server since last updating the News data. If changes present, post an alert letting user know, and asking if they'd like to read it now. At that point, the latest news is already downloaded and cached, so they can simply read it later if they want, and I won't post anymore alerts until the server file changes again. (And one could add a preference/setting to disable these alerts.)
I'm thinking this would be a good way to let people know that some nasty bug is known and fixed and an update is sitting in the queue, solicit beta testers, promote upcoming features or other apps, etc. I can see where constant alerts everytime I've got something new to promote would get annoying, so having a setting to disable them means the user never has to read them unless they want to. Although some kind of override to warn of recently discovered/fixed bugs seems sensible.
FWIW, the author of Mover+/Mover has just started doing a similar thing, though I think Emanuele is perhaps only showing one Notelet at a time, whereas I envision a bit more of a history (shown in UIWebView) until I decide to age stuff off the bottom of the stack.
I'm using a scroll/page view to show several images containing small notes. Each image then tells the user about the more advanced functions on a specific part of the app.
In my opinion the help should only contain information that isn't a 100% relevant for the use of the application. It should be things the advanced user should use to make more use of the app. It should contain gold for the power users. The "basics" should be so obvious that no help would ever be needed. If that's not the case, I think, you've failed as a developer on the iPhone platform.
(Here's a screen shot from my demo app)
I'm currently creating a fairly complicated app. I'm thinking of doing help as a semi-transparent overlay - help in text form is hard to swallow for users; it's much more helpful to just point at stuff and say "this does that".

Is there a good iphone sdk documentation site that provides good examples / common usage?

The problem? I look up stuff in the xcode documentation and find very useful lists of objects, methods, etc... But then I still have to go somewhere else to find useful example code of how to use that object. For example, I looked up NSNumber yesterday and found all of the neat stuff it can do, but I still had no clue how to use it. That's just an example. I'm sure I could read the objective c pdf front to back and learn something there (which I plan on doing) but what about later? When I'm looking up some UIKit object? Do I have to go find a tutorial each time (or lately, I just ask StackOverflow and you guys take care of me).
Is there a part of the apple website / xcode documentation that shows the example code I'm looking for?
Is there a wiki site out there or something that has what I'm looking for? (I just tried a simple google search "iphone sdk wiki". this site could be good. iphone sdk wiki . I'll check it out. Anyone else have one they like? )
This is also sort of a mild complaint to Apple. Why not a section on each code definition page that shows usage?
I've found the sample code section on Apple's iPhone Developer Connection be extremely useful not only for samples of complete applications but also a best practices source. Going through the code of The Elements, for example, will expose you to how to use particular classes as well as how to structure your code. It is a wonderful example of how to create a non-trivial iPhone app.
Look in developer.apple.com/iphone they have pretty good documentation (you can use the search bar there) on all the classes and have a lot of good sample code..
I really would emphasize the "Related sample code" section on many, if not most, of the documented classes.
But, IMHO, there isn't any easy way of acquiring the knowledge to develop in Cocoa/Cocoa Touch. The API's are so numerous that it simply takes a lot of time and experience. You just have to work on it, look at a lot of books and study the sample source code where available.
I've tried to take a purposeful approach by carving out some time every week to learning a new API/class irrespective of whether my current project needs it or not.
Alternatively, search Joe Hewitt. He's the developer for iPhone facebook. He has a project you can download that demonstrates all the features of facebook. It's an awesome open source project!
When you look something up in Xcode Developer Documentation, you sometimes get a Related Sample Code: text that tells you what Sample the method or property is used in. Too bad you can't click on it to see the code, but if you do click it takes you to the page to download the sample. – mahboudz 0 secs ago
Apple Developer site has all kinds of code examples. Try searching google for a UICatalog project, it will show you all the basic UI stuff you can do, like adding buttons and progressbars through using only code.