ybsgir

Q: iAd Producer linking through code view

Im trying to write some custom HTML content and have a few links (<a href="">) link to different pages within my iAd document. I have tried something like this:

<a href="page2">Test Link</a> where the name of my second page is page2.

 

I know Im thinking to simplistic here as I am new to iAd so any guidance would be greatly appreciated.

 

Thanks so much!

MacBook Pro, OS X Mavericks (10.9.1)

Posted on Jan 9, 2014 7:59 PM

Close

Q: iAd Producer linking through code view

  • All replies
  • Helpful answers

  • by markmalone,

    markmalone markmalone Jan 10, 2014 10:39 AM in response to ybsgir
    Level 2 (210 points)
    Jan 10, 2014 10:39 AM in response to ybsgir

    Take a look at the recommendations/limitations of the HTML object here: http://help.apple.com/iadproducer/mac/4.1/#iade083c9723

     

    In general, this object is best used for content that confines its interaction/navigation to content within the HTML object itself.  It's great for styled text, canvas animation, MathML, or imbedding remote content via an iframe. 

     

    iAd Producer has a really nice model for page navigation and loading which you should see if your design supports before rolling your own code.  Page navigation can be hooked up visually by selecting any view then choosing "Go to Page" in the Interaction section of the Inspector panel.  If you need to write code for navigation you can leverage the ViewController object (logically the page) by calling its transitionToViewControllerWithID('PAGE_ID') method.

     

    Of course everything depends on your particular design, but the more you can layout visually using the built-in objects then hook into the iAd.JS interaction model the happier you'll be.   If you've go any more specifics on what you'd like to build, I can be more specific.

     

    Clear as mud?

     

    Cheers,

     

    -Mark

  • by markmalone,

    markmalone markmalone Jan 10, 2014 1:51 PM in response to markmalone
    Level 2 (210 points)
    Jan 10, 2014 1:51 PM in response to markmalone

    That said,  getting a reference to the current page instance via its outlet name then call the instance method transitionToViewControllerWithID should do the trick.

     

    Something like:

     

    <a href="#" onclick="iAP.ViewController.instances['Page1'].transitionToViewControllerWithID ('Page2')"> Click Me!</a>

     

    Where 'Page1' is the outlet value of your current page with the spaces removed and 'Page2' refers to another page with the outlet value spaces removed.

     

     

    -Mark