[Sample] Jack In The Box (Fun with CoreAnimation)

Discussion in 'iOS Development' started by SkylarEC, Jul 27, 2009.

  1. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129

    Please Register or Log in to view images



    Just a note, I DID NOT make this application. I simply did a real quick port of the application that can be found here: http://watchingapple.com/2008/04/core-animation-creating-a-jack-in-the-box-with-cakeyframeanimation/

    I took the cat's source code and made a real quick port to iPhone API. I did not check his work, my work, or any of that.

    The port consisted of:
    1. Taking the original source code and replacing all non iPhone API with iPhone API.
    2. Rebuilding the nibs, converting to iPhone API.
    3. Tweaked the numbers that make up the locations of the layers.
    4. Rotated the view that contains all the sub layers. Yes, I could have translated the coordinate grid, and that would have been the right thing to do, AND it would have been one line of code as well, but meh.

    In other words, this was a five minute port job, and I take no credit for this. I also accept no blame if this makes your phone blow up, as I did NOT examine the code.

    Regardless, I thought you all would have a blast with some CoreAnimation. It's super fun and easy!
    Video: http://www.skylarcantu.com/videos/JackIntheBox/JackIntheBox.mov
    Source Code (Xcode project): http://www.touchrepo.com/SampleCode/JackIntheBox.zip
  2. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    That is quite cool. I'll look into it more closely in a bit.
  3. David.

    David. Active Member

    Joined:
    Feb 24, 2009
    Messages:
    2,565
    Likes Received:
    1
    Device:
    4G iPod touch
    Looks pretty good.
  4. ipodmail09

    ipodmail09 Member

    Joined:
    Mar 13, 2009
    Messages:
    269
    Likes Received:
    0
    Device:
    2G iPod touch
    dam source code does not work... [3.0]
  5. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Can you elaborate on what errors you get? I compiled this on 3.1, but I can't imagine anything that would prevent it from compiling for 3.0. If it's simply that you don't have the option to compile for 3.1, then fear not. Right click on the project file and click "Get Info." Select the first tab and change the base SDK to 3.0.
  6. ipodmail09

    ipodmail09 Member

    Joined:
    Mar 13, 2009
    Messages:
    269
    Likes Received:
    0
    Device:
    2G iPod touch
    all the coding is fine but when you get to the simulator it crashes unexpectedly.
  7. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    What does GDB say when it crashes?
  8. King Chronic

    King Chronic New Member

    Joined:
    Mar 17, 2008
    Messages:
    687
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    go to the "console" button after you press build&go, then when the gdb prompt comes up type "bt" and paste the entire console output + the "bt" output to pastie.
  9. veeloc

    veeloc New Member

    Joined:
    Sep 6, 2008
    Messages:
    815
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    built for 3.0 simulator:
    2009-08-19 17:41:28.991 JackIntheBox[4552:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69)'
    2009-08-19 17:41:28.993 JackIntheBox[4552:20b] Stack: (
    807902715,
    2440224315,
    807986683,
    807986522,
    810630007,
    816532266,
    816541363,
    814712305,
    814750229,
    814739251,
    814722434,
    814748641,
    839148405,
    807687520,
    807683624,
    814715661,
    814752238
    )

    when building on 2.2.1 simulator, terminates due to uncaught exception, "bt" output:
    #0 0x9231df54 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ ()
    #1 0x9172de3b in objc_exception_throw ()
    #2 0x922a4a53 in CFRunLoopRunSpecific ()
    #3 0x922a4c78 in CFRunLoopRunInMode ()
    #4 0x31566600 in GSEventRunModal ()
    #5 0x315666c5 in GSEventRun ()
    #6 0x30a4eca0 in -[UIApplication _run] ()
    #7 0x30a5a09c in UIApplicationMain ()
    #8 0x00002910 in main (argc=1, argv=0xbfffee50) at /Users/Jay/Downloads/JackIntheBox/
  10. ipodmail09

    ipodmail09 Member

    Joined:
    Mar 13, 2009
    Messages:
    269
    Likes Received:
    0
    Device:
    2G iPod touch
    yep thats what i get too

Share This Page