Adding Apple Remote Support to your Cocoa App

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Adding Apple Remote Support to your Cocoa App - Presentation Transcript

    1. Adding Apple IR Remote Support to Your App Mark Aufflick February 1, 2009 + Mark Aufflick February 1, 2009 Slide 1/9
    2. Rule #1 of Programming Everything should be code. Perhaps that’s why I like LTEX so much. A (Or perhaps it’s because MS Word and Endnote bite.) Ergo. . . Mark Aufflick February 1, 2009 Slide 2/9
    3. LTEX slides–beamer A The LTEX beamer “document class” allows you A to easily create slides with notes: \\ begin { frame }{ LaTeX slides - - beamer } \\ begin { itemize } \\ item The LaTeX beamer ‘‘ document class ’ ’ allows you to easily create slides with notes : \\ end { itemize } \\ end { frame } \\ note [ itemize ]{ \\ item Here are some notes . } Mark Aufflick February 1, 2009 Slide 3/9
    4. SplitShow PDF Presentation pdflatex + beamer → PDF files So we need a way to present PDF files Preferably with notes on our second screen so I can sound like I know what I’m talking about Splitshow.app allows two screen presentations from PDF http://code.google.com/p/splitshow Mark Aufflick February 1, 2009 Slide 4/9
    5. Adding Apple IR Remote Support to Your SplitShow PDF Presentation 2009-02-01 App SplitShow PDF Presentation pdflatex + beamer → PDF files So we need a way to present PDF files Preferably with notes on our second screen so I can sound like I know what I’m talking about Splitshow.app allows two screen presentations from PDF http://code.google.com/p/splitshow • Toggle to notes screen by holding Play/Pause button on remote.
    6. Apple IR Remote Support Splitshow didn’t have Apple IR Remote Support I added it using classes by Martin Kahr: http://www.martinkahr.com/source-code Mark Aufflick February 1, 2009 Slide 5/9
    7. Implementing Apple IR Remote Support Add the class files to your project Add the Carbon Framework (the IR classes dig into IOKit and Carbon) Create a class to be a delegate to both NSApplication and RemoteControl Or you can use RemoteControlContainer instead of RemoteControl and get Keyspan support for free Mark Aufflick February 1, 2009 Slide 6/9
    8. NSApplication Delegate Methods Create RemoteControl instance, and set self as delegate via: - ( void ) a p p l i c a t i o n D i d F i n i s h L a u n c h i n g :( NSNo tificati on *) n { remoteControl = [[ RemoteControl alloc ] i n i t W i t h D e l e ga t e : self ]; [ remoteControl startLi stening : self ]; } Monopolise/release the remote control via: - ( void ) a p p l i c a t i o n W i l l B e c o m e A c t i v e :( NSNotif ication *) n { [ remoteControl startLi stening : self ]; } - ( void ) a p p l i c a t i o n W i l l R e s i g n A c t i v e :( NSNotif ication *) n { [ remoteControl stopListening : self ]; } Remember to instantiate and connect your NSApplication delegate in MainMenu.xib Mark Aufflick February 1, 2009 Slide 7/9
    9. NSApplication Delegate Methods Create RemoteControl instance, and set self as delegate via: - ( void ) a p p l i c a t i o n D i d F i n i s h L a u n c h i n g :( NSNo tificati on *) n { remoteControl = [[ RemoteControl alloc ] i n i t W i t h D e l e ga t e : self ]; [ remoteControl startLi stening : self ]; } Monopolise/release the remote control via: - ( void ) a p p l i c a t i o n W i l l B e c o m e A c t i v e :( NSNotif ication *) n { [ remoteControl startLi stening : self ]; } - ( void ) a p p l i c a t i o n W i l l R e s i g n A c t i v e :( NSNotif ication *) n { [ remoteControl stopListening : self ]; } Remember to instantiate and connect your NSApplication delegate in MainMenu.xib Mark Aufflick February 1, 2009 Slide 7/9
    10. Adding Apple IR Remote Support to Your NSApplication Delegate Methods 2009-02-01 App NSApplication Delegate Methods Create RemoteControl instance, and set self as delegate via: - ( void ) a p p l i c a t i o n D i d F i n i s h L a u n c h i n g :( NSNot ificati on *) n { remoteControl = [[ RemoteControl alloc ] i n i t W i t h D e le g a t e : self ]; [ remoteControl startLis tening : self ]; } Monopolise/release the remote control via: - ( void ) a p p l i c a t i o n W i l l B e c o m e A c t i v e :( NSNotifi cation *) n { [ remoteControl startLis tening : self ]; } - ( void ) a p p l i c a t i o n W i l l R e s i g n A c t i v e :( NSNotifi cation *) n { [ remoteControl stopListening : self ]; } Remember to instantiate and connect your NSApplication delegate in MainMenu.xib • http://code.google.com/p/splitshow/source/ browse/trunk/src/SSAppDelegate.m • Switch to Xcode to show code (after revealing second method).
    11. RemoteControl Delegate Method - ( void ) s e n d R e m o t e B u t t o n E v e n t :( R e m o t e C o n t r o l E v e n t I d e n t i f i e r ) event pressedDown :( BOOL ) pressedDown remoteControl :( RemoteControl *) remoteControl event is an integer, matching one of a number of constants, eg: kRemoteButtonLeft kRemoteButtonRight kRemoteButtonRight Hold kRemoteButtonPlay Simply perform the appropriate method call by matching event in a case statement. Often you want to discard button up events. Mark Aufflick February 1, 2009 Slide 8/9
    12. Adding Apple IR Remote Support to Your RemoteControl Delegate Method 2009-02-01 App RemoteControl Delegate Method - ( void ) s e n d R e m o t e B u t t o n E v e n t :( R e m o t e C o n t r o l E v e n t I d e n t i f i e r ) event pressedDown :( BOOL ) pressedDown remoteControl :( RemoteControl *) remoteControl event is an integer, matching one of a number of constants, eg: kRemoteButtonLeft kRemoteButtonRight kRemoteButtonRight Hold kRemoteButtonPlay Simply perform the appropriate method call by matching event in a case statement. Often you want to discard button up events. • http://code.google.com/p/splitshow/source/ browse/trunk/src/SSAppDelegate.m • Switch to Xcode to show code.
    13. Fin Now your Cocoa Application has Apple Remote support :) Mark Aufflick February 1, 2009 Slide 9/9

    + markaufflickmarkaufflick, 6 months ago

    custom

    983 views, 0 favs, 2 embeds more stats

    In the April CocoaHeads Sydney I gave a semi-lightn more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 983
      • 954 on SlideShare
      • 29 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 4
    Most viewed embeds
    • 27 views on http://mark.aufflick.com
    • 2 views on http://www.stile.ch

    more

    All embeds
    • 27 views on http://mark.aufflick.com
    • 2 views on http://www.stile.ch

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories