views:

576

answers:

6

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?

+2  A: 

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..

Daniel
+4  A: 

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.

ennuikiller
+1  A: 

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

mahboudz
+1  A: 

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.

AWright4911
+2  A: 

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!

AWright4911
Wow! that's tight!
Neo42
+2  A: 

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.

alan