Drawing a Sine Wave Part 2

Update: April 11, 2007: Please take a look at the comments section if you are having trouble building the Xcode project(I did test it with Xcode 2.4.1 by the way)

Update: April 6, 2007: I am uploading a pdf file with additional instructions(it assumes steps 1 – 3 below are done, with the exception of building the Xcode project) Get the pdf file here: Directions

Update: April 5, 2007: Fixed a small typo(Step 4 assumes to Step 3 assumes).

I did manage to draw a sine wave from scratch. Actually, it looked so impractical that I ended up generating a more polished sine wave using the SM2DGraphView Cocoa framework

Actually the example code provided by SnowMint Creative Solutions LLC shows one how to draw a sine wave. The trick is using the instructions provided correctly to compile and build the sample code. Here is a way to do it:

  1. Download the Disk Image(DMG) and extract it
  2. Follow the “Simple Installation of prebuilt products ” and “Setting up the .palette in Interface Builder” procedures here. Note: Step 3 assumes the framework was put in /Library/Frameworks
  3. Download my Xcode project I created and run it. You can get it from my website. I use Xcode 2.2.1(I know, I have to upgrade to 2.4.1 soon).

PLEASE BE SURE TO READ THE NOTICE BELOW(REQUIRED BY SNOWMINT CREATIVE SOLUTIONS):

Permission Notice and Disclaimer

Copyright 2002-2003 Snowmint Creative Solutions LLC.
http://www.snowmintcs.com/

Permission to use, copy, modify and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies, and that both the copyright notice and this permission notice appear in supporting documentation, and that the copyright notice appears in any location where your own copyright notice is viewable by end users, and that the name of Snowmint Creative Solutions LLC not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Snowmint Creative Solutions LLC makes no representations about the suitability of this software for any purpose. It is provided “as is” without express or implied warranty.

Snowmint Creative Solutions LLC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL Snowmint Creative Solutions LLC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Advertisements

5 responses to “Drawing a Sine Wave Part 2

  1. Hi,

    I have followed the install instructions but am having problems building your project. Maybe because my xcode is version 2.4?

    I’m getting ‘uncaught exception was raised’ error and NSArchiverArchiveInconsistency, ‘inconsistency between written and read data for object’ strange error messages!

    I’m running 10.4.9 and xcode 2.4 with Component versions
    Xcode IDE: 759.0
    Xcode Core: 757.0
    ToolSupport: 733.0

    Any ideas?

    Dan.

  2. Hi Dan,

    I just recreated an Xcode 2.4.1 project from scratch. I will put it up. I will also put up the steps I followed in creating the project(these steps might probably be more useful to you–I am guessing the build problems might come from subtle ties to my machine the older xcode project has(I have no idea what they might be!)

    I am now running 10.4.9(Intel Mac) with Xcode 2.4.1 and
    Xcode IDE: 762.0
    Xcode Core: 762.0
    ToolSupport: 764.0

    I will let you know once I am done.

    Couple of things to look at meanwhile(silly checks again 🙂 )
    You didn’t follow the “Building the Framework” instructions at the bottom of the SM2DGraphView Getting Started page in step 2 of the post, right? (you don’t have to build the framework from source)
    Also, my Xcode project is set up to build for i386(Intel architecture). You can check this in Project -> Edit Project Settings, and go to the Build Tab View.
    One last check. See if you can start Interface Builder and see if you see the SM2DGraphView palette in the Controls panel(these will be Cost-Time, Pie Chart ,etc icons)

    Once again, I’ll get back to you on this subject(hopefully shortly).

  3. Dan,
    I am uploading a pdf file with some directions on making your own Xcode project. The instructions there assume that steps 1, 2, and 3 in the post above are already finished–with the exception of actually building the old Xcode project in step 3. I can upload the newer project I created, but this method is probably better–it takes away any machine dependencies.
    Feel free to let me know if you still have problems with the build.
    Regards,
    Chinmoy

  4. Hi Chinmoy,
    I got it working. I’m new to both programming and cocoa, but it is fun to play with! And definitely triggered interest in learning more.
    Two things to watch out for:
    – in the build tab of the project settings you can choose between ‘debug’ and ‘release’ settings. Depending on what you compile/run, make sure those are set correctly
    – I put the SM2DGraphView framework in ~/Library/Frameworks and not, as indicated in steps 11 and 12 of the pdf in /Library Frameworks (I found the difference confusing at the beginning too, but ~/ is the current user’s folder, and / is the system’s folder — at least that’s how I understand it). Depending on where the framework is put, that directory needs to be referenced in the project settings.

    Great example!
    Cheers,
    Claus

  5. Hi Claus,

    >> Two things to watch out for…

    You are right. ~/Library/Frameworks is expanded to /Users/(someuniquename)/Frameworks, but /Library/Frameworks should be the same on everyone’s Mac, where someuniquename is replaced by the chinmoygavini on my computer. I’ll update the pdf sometime to make that more clear….meanwhile, people can take a look at your comment 🙂

    I am glad you found this post useful. Thanks for your feedback. I’ll continue putting some notes on Cocoa here, depending on when I’m free. If you are new to programming, I recommend learning the basics of C and reading Thinking in C++ (by Bruce Eckel). Yes, C++ seems to be kind of a dead language, but if you know C++ well, you can learn to program well in Java and Objective-C(and *shudder* C# 🙂 ) relatively quickly. It is much much harder learning C++ after first learning something like Java. Also, coming from a C++ background, I can tell you that learning the basics of Objective-C has been very easy.

    Regards,

    Chinmoy

    P.S. It is harder to go to something like C++ or even Java after you are used to an untyped(actually dynamically typed) language like Objective-C.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s