Learning Cocoa
-
I have just finished the CurrencyConverter tutorial (was easy, but i don't
think i learned a lot) and read 'OO programming and the ObjC language'. What
would be your suggested 'next step's to learn Cocoa? The rest of Apple's
documentation seems to be API-references only, and i do not really feel
ready for that.
I'm also a little bit confused by all those different frameworks (Foundation
Framework, CoreFoundation, AppKit...). What does what, and where is their
usage described?
I already have (some) experience in C++/PowerPlant (if that helps/harms).
Thanks
Manfred
PS:
What's the equivalent to WASTE in Cocoa? I used to have a text document with
graphics and non-user-editable text (i solved that in WASTE by making that
graphics too).
--
Manfred Schubert <manfred...>
<http://www.schubert-it.com> -
On Thursday, January 25, 2001, at 12:40 AM, Manfred Schubert wrote:
> I'm also a little bit confused by all those different frameworks (Foundation
> Framework, CoreFoundation, AppKit...). What does what, and where is their
> usage described?
CoreFoundation: C-API for things like arrays, dictionaries, dynamic code loading and so on
Foundation Framework: A ObjC-wrapper for CoreFoundation
In general, the above two are everything that does not require a GUI. You can even write regular console applications with them.
AppKit: ObjC framework for everything involving the GUI (like buttons, windows...)
> I already have (some) experience in C++/PowerPlant (if that helps/harms).
I think that it helps insofar that you know how to handle a framework (not the thing MacOS X calls a framework, the way PP uses this term).
Learn ObjC, and don't try to copy C++.
The most important difference is that you normally don't have to subclass anything. You can tell a control to ask another object for its parameters. That makes it IMHO much easier to build complex applications (I remember digging in the PP source for about one month trying to figure out how to properly display an icon...)
> PS:
> What's the equivalent to WASTE in Cocoa? I used to have a text document with
> graphics and non-user-editable text (i solved that in WASTE by making that
> graphics too).
Try an NSTextView. If you want to know what this control can handle, look at TextEdit. It's basically an application wrapper for it.
You can set the text to be non-editable. It can handle HTML, RTF, and RTFD (RTF with images). Or you can use an NSImageView for PDFs.
andy
--
Description forthcoming. -
At 01:01 +0100 1/25/01, Andreas Monitzer wrote:
> On Thursday, January 25, 2001, at 12:40 AM, Manfred Schubert wrote:
>> PS:
>> What's the equivalent to WASTE in Cocoa? I used to have a text document with
>> graphics and non-user-editable text (i solved that in WASTE by making that
>> graphics too).
>
> Try an NSTextView. If you want to know what this control can handle,
> look at TextEdit. It's basically an application wrapper for it.
> You can set the text to be non-editable. It can handle HTML, RTF,
> and RTFD (RTF with images). Or you can use an NSImageView for PDFs.
>
> andy
>
the ability to simply display HTML is exactly what I need. are you
sure NSTextView handles HTML? the docs at apple.com don't mention
anything other than RTF and RTFD.
jeff
> --
> Description forthcoming.
> _______________________________________________
> MacOSX-dev mailing list
> <MacOSX-dev...>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
-
> would be your suggested 'next step's to learn Cocoa? The rest of Apple'shttp://www.stepwise.com/Articles/VermontRecipes/index.html
> documentation seems to be API-references only, and i do not really feel
> ready for that.
>
These are tutorials.
There are lots of links to other resources at this site.
The technical articles on Stepwise are good. -
on 1/24/01 6:40 PM, Manfred Schubert at <manfred...> wrote:
> I have just finished the CurrencyConverter tutorial (was easy, but i don't
> think i learned a lot) and read 'OO programming and the ObjC language'. What
> would be your suggested 'next step's to learn Cocoa? The rest of Apple's
> documentation seems to be API-references only, and i do not really feel
> ready for that.
Vermont Recipes - A Cocoa Cookbook. See the URL, below.
-
Bill Cheeseman, Quechee, Vermont <mailto:<cheeseb...>
The AppleScript Sourcebook
<http://www.AppleScriptSourcebook.com/>
Vermont Recipes-A Cocoa Cookbook
<http://www.stepwise.com/Articles/VermontRecipes/> -
> the ability to simply display HTML is exactly what I need. are you
> sure NSTextView handles HTML? the docs at apple.com don't mention
> anything other than RTF and RTFD.
Yes, I'm using it my app (because I'm too lazy to learn how use
NSAttributedString and need HTML display anyways):
[[messageView textStorage] setAttributedString:[[[NSAttributedString
alloc] initWithHTML:[NSData dataWithBytes:[theString cString]
length:[theString length]] documentAttributes:nil] autorelease]];
This one took me a day to figure out :)
andy -
> I have just finished the CurrencyConverter tutorial (was easy, but i don't
> think i learned a lot) and read 'OO programming and the ObjC language'. What
> would be your suggested 'next step's to learn Cocoa?
How about the material at Stepwise? Scott's editor project/tutorial seemed pretty good, and the Vermont Recipes looks good, too.
I had an overview article in MacTech last year, and Andrew Stone has also written for that magazine, so if you can get those issues, that may be a place to look.
> The rest of Apple's documentation seems to be API-references only, and i do not
> really feel ready for that.
> I'm also a little bit confused by all those different frameworks (Foundation
> Framework, CoreFoundation, AppKit...). What does what, and where is their
> usage described?
Don't bother about CoreFoundation; its a layer below Foundation, and accessible from Carbon. (Foundation is largely implemented in terms of CoreFoundation structs; NSString -> CFString, NSArray->CFArray, and so forth.)
Foundation is collection classes and class clusters (NSArray, NSDictionary, NSSet, NSString...), iteration (NSEnumerator), serialization (NSCoder, NSArchiver, NSUnarchiver), communcations tools (NSPort, the Distributed Objects system, etc), task and thread management (NSTask, NSThread), notifications (NSNotificationCenter and friends), exceptions (NSException) and many other low level things. Foundation is where you interact with the machine. It can be used in servers, command line tools, applications and just about anything else. Foundation objects are typically quite opaque, and difficult to subclass --- that's not the intended usage pattern. Composition is a good pattern to use with Foundation objects.
AppKit is for building applications, particularly the user interface. (Windows, views, buttons, documents, undo/redo support, object based drawing...) The AppKit uses and extends many Foundation objects. (For example, NSString is defined in the FoundationKit, but string drawing is defined in the AppKit.) Many AppKit classes are very suitable for subclassing (NSCell and NSView are good examples).
> I already have (some) experience in C++/PowerPlant (if that helps/harms).
Knowing a tool never hurts. You just have to get used to the idea that, even though you own a hammer, not every problem is a nail.
Read the Apple docs on the model view controller paradigm. If you want to build document based applications, and take advantage of the AppKit, you must understand that.
Download some open source applications and mess with the user interface in InterfaceBuilder. Make sure you understand how the "first responder" system works.
Learn about composition, delegates and forwarding; those are important tools in Cocoa programming. There should be some articles on that at Stepwise.
Read the rules on retain/release/autorelease and object ownership, I think there is an article about that at Stepwise, and Apple's docs cover it.
Look at Marcel Weiher's higher order messaging, and (less important) at my Concrete Protocols; both exploit the Objective-C runtime and the dynamic nature of the Objective-C language.
I'd try to get started on some simple projects as soon as possible. That's really the best way to learn the frameworks.
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com -
At 08:14 +0100 1/25/01, Andreas Monitzer wrote:
>> the ability to simply display HTML is exactly what I need. are you
>> sure NSTextView handles HTML? the docs at apple.com don't mention
>> anything other than RTF and RTFD.
>
> Yes, I'm using it my app (because I'm too lazy to learn how use
> NSAttributedString and need HTML display anyways):
>
> [[messageView textStorage] setAttributedString:[[[NSAttributedString
> alloc] initWithHTML:[NSData dataWithBytes:[theString cString]
> length:[theString length]] documentAttributes:nil] autorelease]];
>
> This one took me a day to figure out :)
I can see why!
and FYI, it appears that this selector (i.e., initWithHTML) is yet to
be available in the Java APIs for Cocoa. :(
jeff
> andy
> _______________________________________________
> MacOSX-dev mailing list
> <MacOSX-dev...>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
-
>> I have just finished the CurrencyConverter tutorial (was easy, but i don't
>> think i learned a lot) and read 'OO programming and the ObjC language'. What
>> would be your suggested 'next step's to learn Cocoa?
Well, I suggest this link for learning Mac OS X Server from Apple:
http://developer.apple.com/macosx/server/mosxserverdev/rhapsody_basics.html
and this one for examples:
http://developer.apple.com/macosx/server/mosxserverdev/yellowcode.html
Mac OS X Server is of course different but just a little. I think it
is a good start.
Good luck!
Tib.



