Talk:Programming Mac OS X with Cocoa for beginners

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

What is this? Where is the downloadable code? —The preceding unsigned comment was added by Kray257 (talkcontribs) . (This comment was left on /Download code examples --SB_Johnny | talk 11:13, 23 August 2006 (UTC))

[edit] -kHandleSize parameter needs to be decalared!

PROBLEM!!!!

-kHandleSize is a parameter in the method drawBounds and in the return value for the method handleRect; and needs to be declared somewhere! The proceeding methods are in different files as well so the scope of -kHandleSize goes beyond either file.

This omission prevents the application from compiling!

Also the source files are not available from the link in this Wiki Books directory as they are supposed to be. A missing page error appears when the link to download the source is clicked. This is an excellent tutorial and it's a shame that it is not usable in it's current form.


[edit] _dragShape undeclared

The _dragShape data object in WKDDrawView is undeclared as well and causes a compile time error. -Boogityboo04

whoever wrote this, thank you

[edit] Some Problems and Fixes

Thanks for this very helpful introduction; you've obviously spent a lot of time on it. I've found a few problems with the page "Wikidraw's view class" (some noted by previous users). Here they are:

1. kHandleShape is not defined in WKDShape.m. The answer to this is to define a static int up about the @implementation section:

 static int kHandleSize = 3;

2. _dragShape is not declared in WKDDrawView.h. I'm pretty sure this is supposed to be a WKDShape*, right? So you need to add this:

 WKDShape* _dragShape

3. There are some #imports missing. If I recall, you need #import "WKDShape.h" in WKDDrawView.{h,m}.

4. You forgot to write the implementation for currentTool in ToolsController.m. This is easy: just return _curTool.

5. There is a bug in how WKDDrawView learns about tool changes (via notifications). If the user changes tools but there are no documents open, then nothing will be subscribed to the event, and sCurrentTool won't be changed. But I gather that this whole notification business is more for teaching the concept than good design, so you might just want to mention that it has this flaw.

Thanks again for all your work!