This is part of an ELC Tech Network

231 Comments

  1. ash
    Posted October 27, 2009 at 8:46 am | Permalink

    im having trouble with the labels connection, when i drag down toward the file owner it only come up with View, and that it there is no player score or computers score, i dont know why this has happened, it works with the images but it wont work with the labels and even the texts

    please get back to me a soon as possible

    • Tom
      Posted April 9, 2010 at 7:34 pm | Permalink

      In response to ash’s question, i had the same problem but by saving the iTennisViewController.h file when you’ve added the code, then entering Interface Builder it works just fine.

    • Posted June 7, 2010 at 11:27 am | Permalink

      Tom’s answer may have worked, but are you dragging from the label to the file’s owner, or the file’s owner to the label? The only way it works it to drag the file owner’s outlet to the label.

      • Posted June 7, 2010 at 11:29 am | Permalink

        Also, try right clicking on the file owner and dragging to the label.

  2. Remi
    Posted November 7, 2009 at 11:25 am | Permalink

    Thanks very helpful !

  3. Tommy Myers
    Posted November 21, 2009 at 3:59 am | Permalink

    Hi,

    how can i modify the app to play against your friends through bluetooth?

    Tommy

    • David
      Posted April 24, 2010 at 11:03 am | Permalink

      1. this is supposed to be for a tutorial- he/she has gone to the trouble of making it for you- how much more can you ask for???
      2. bluetoothing is incredibly hard

  4. Aussie96
    Posted November 26, 2009 at 4:29 am | Permalink

    Hey guys,

    Im having trouble Connecting “New Referencing Outlet” and “File’s Owner”, which is displayed in the video. This is needed to connect the racquets, scores and ball. Obviously this is one of the most vital parts in this application, though I cant do it.

    All help will be greatly appreciated!

    • Posted June 7, 2010 at 11:31 am | Permalink

      Try right clicking on the file owner. If you did the stuff in the iTennisViewController.h, then you should be able to see them there.

      • Posted June 7, 2010 at 11:32 am | Permalink

        don’t use the New Referencing Outlet

  5. Simon88
    Posted December 6, 2009 at 6:27 pm | Permalink

    In answer to a lot of the problems with

    *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “iTennisViewController” nib but the view outlet was not set.’

    The chances are you followed the tutorial but havn’t set the view connection itself.
    If you look through your connections, all your major objects should be connected, but i found with mine that I was missing the “view” connection at the bottom. You want to drag this one to the “view” box in your iTennisViewController.xib window.

    Once this is connected, save, and rebuild and run your project!

  6. Nick
    Posted January 14, 2010 at 3:27 pm | Permalink

    Hey Brandon,

    You da’ man!.. Amazing walk-through Xcode.. As a first time app developer I was pretty intimidated..(still kind of am actually), but this tutorial definitely opened my eyes… Props! and I could help notice the inconsiderate moron that tried to sell your exact game to apple..lol.. hope you have him on his knees begging for mercy.

    N.

  7. Andy
    Posted January 30, 2010 at 8:44 am | Permalink

    Great writeup!

    Question, I’m trying to change the game from portrait to landscape, I’ve already rotated my images and switched interface builder to landscape, but what do I need to alter in the code? P.S. when I simulate it, it is in portrait with the court squeezed into landscape. Thanks!

    • cooldaddybeck
      Posted March 13, 2010 at 2:25 pm | Permalink

      Andy, for adjusting from portrait to landscape (to be used in your tennisViewController.m and SplashViewController.m files):

      // Override to allow orientations other than the default portrait orientation.
      - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
      }

    • Posted June 7, 2010 at 11:33 am | Permalink

      press control, and then a side arrow key in the simulator. That rotates it.

  8. Chimpy
    Posted February 5, 2010 at 3:17 pm | Permalink

    Hi Brandon,

    how would you limit the width that the paddles could move ?
    so the ball could squeeze between the paddle and the side of the screen ?

    thanks

    Chimpy

  9. Posted February 15, 2010 at 2:14 pm | Permalink

    Greta site man! Keep the tutorials coming!

  10. Posted February 18, 2010 at 6:13 pm | Permalink

    Hello,
    I am new to xcode and c programming and iphone programming. I have sucessfully “built” this tutorial but it says that it “failed to launch simulated application: iPhone Simulator failed to install the application.” I have it set to iPhone Simulator 3.1 and have tried 3.0 as well.

  11. Chris
    Posted February 28, 2010 at 8:01 pm | Permalink

    @Brandon quicktime movie wont play to show the setting up of the UI!

  12. Salim
    Posted March 1, 2010 at 11:00 pm | Permalink

    Hii,
    Can u please send me the whole code on my E-mail address that i can study n learn more thing.

  13. Salim
    Posted March 2, 2010 at 1:07 am | Permalink

    Hi Narender,

    I will Try to do this And its working. can you please send me the racquet_yellow code….
    on my email add please.

  14. Sylvain
    Posted March 23, 2010 at 8:09 am | Permalink

    Hello,

    Why do we call :

    self.gameState = kGameStatePaused;
    ballVelocity = CGPointMake(kBallSpeedX,kBallSpeedY);

    et not : (missing “self”)

    self.gameState = kGameStatePaused;
    self.ballVelocity = CGPointMake(kBallSpeedX,kBallSpeedY);

    then here (missing self)

    if(gameState == kGameStatePaused) {…
    end not

    if(self.gameState == kGameStatePaused) {….

    Thank you.

  15. J. Cohen
    Posted April 1, 2010 at 8:18 am | Permalink

    I completed this first tutorial. The program builds and loads into the iPhone simulator without problem. It briefly shows the load screen, then displays the tennis court which I built according to the video. However, nothing happens when I click to continue! I might be wrong, but it would seem that, based on my understanding of the code, that it should start the ball moving.

    Should it?

    Or do I have to do step 2 before anything actually happens?

    I’m reluctant to continue before I know that I have completed these steps properly. Thanks!

    • J. Cohen
      Posted April 1, 2010 at 2:29 pm | Permalink

      Well it was a – instead of an = that was making it fail… works now :)

    • Doug Stafford
      Posted April 13, 2010 at 2:39 pm | Permalink

      Great tutorial.

      I have finished part 1, but the tennis ball is not moving?

      Any ideas?

      Thanks

  16. Matt
    Posted April 2, 2010 at 12:29 pm | Permalink

    I have the problem where only my tennis court shows up. Anyone know what I’ve done wrong? Thanks in advance for any tips!

  17. Posted April 11, 2010 at 9:05 pm | Permalink

    Hey Brandon, great tutorial, very helpful and easy to understand. I have an idea for an iPhone game, sports training related. I know you probably get this a lot, lol, but I do not want to go into too much detail on a blog, but if you could take a moment and check out my website, listed above, you will see the type of training I do, it may give you a hint as to what I am looking to develop. Please feel free to email me at my email address listed above and I can go into more detail.

    Thanks
    Rick

  18. macmandev
    Posted April 16, 2010 at 8:07 pm | Permalink

    i downloaded the source code but the points don’t count up and the racquet wont move?
    thanks

  19. darius
    Posted April 18, 2010 at 2:28 pm | Permalink

    Hey, I finally got all the coding to be working and debugged!

    But now when I build and run it, all the simulator shows me is the court pic. I’ve tried messing around in the interface builder but nothing seems to let me see any other object.

    Is there some sort of arrangement order that I need to setup?
    If anyone could help that would be awesome!

    Thank you.

  20. Posted April 20, 2010 at 11:09 pm | Permalink

    Hey Guys,

    I’d like to start off by saying AWESOME tutorial(s) I’ve been finding out more things I can do via the apple developer program now.

    One problem though:
    I’m attempting to reproduce a game like this with a few more complications but am running into an interface error. The code appears to be correct (producing no errors according to Xcode 3.2.2. When the app starts up in simulator, it loads the default.png image without a problem and then the splash.png image. At first there were some fading errors but I managed to fix those when I upgraded Xcode from 3.1.3 to 3.2.2. In any case it still fades the splash screen to a solid white display. I’ve attempted to find help via apple’s technical support, ect. and have no success. Has ANYONE here ever had this problem and if so how did you find a solution?

    • Will
      Posted October 30, 2010 at 5:17 pm | Permalink

      I have had the exact same problem. The fade only works for the default or splash image but for no other image. I even photoshopped an image to get the the same pixel dimensions as the court.png and still no luck

  21. Posted April 20, 2010 at 11:10 pm | Permalink

    Hey Guys,

    I’d like to start off by saying AWESOME tutorial(s) I’ve been finding out more things I can do via the apple developer program now.

    One problem though:
    I’m attempting to reproduce a game like this with a few more complications but am running into an interface error. The code appears to be correct (producing no errors according to Xcode 3.2.2. When the app starts up in simulator, it loads the default.png image without a problem and then the splash.png image. At first there were some fading errors but I managed to fix those when I upgraded Xcode from 3.1.3 to 3.2.2. In any case it still fades the splash screen to a solid white display. I’ve attempted to find help via apple’s technical support, ect. and have no success. Has ANYONE here ever had this problem and if so how did you find a solution?

    If you have an answer you can contact me via my business site at CrawfordWorks.ca
    Thank you in advanced !

  22. Mark
    Posted May 5, 2010 at 9:25 am | Permalink

    Hi. I’m trying to add the court.png file to the imageview– the first step of the video. however, when I try to click the dropdown menu to get court.png, none of my pictures are there.

    It’s like my iTennisViewController.xib isn’t linked to the resource images that I imported. Is there some sort of linking step that I’m missing? I can’t type it manually either because I just get a giant blue question mark.

    Thanks!

    • Posted July 27, 2010 at 4:15 pm | Permalink

      Have you tried saving everything, including your xCode files?

  23. Posted May 31, 2010 at 9:40 pm | Permalink

    This is great, you are the best of the best :) thanks alot

  24. Chris
    Posted June 1, 2010 at 4:01 pm | Permalink

    Anybody else having problems with the video part of the tutiorial (building the interface) buffering? I cant seem to view the movie due to it only buffering a few seconds.

    Are there any other ways to view the movie?

    Just starting this tutorial and would be a real shame to not be able to continue.

    Please reply, Thanks.

  25. Michele
    Posted June 1, 2010 at 4:07 pm | Permalink

    @Simon88
    Thanks a lot for your tip! You save my night :)

    @author
    very very well work
    grazie anche dall’Italia

  26. Chris
    Posted June 1, 2010 at 4:18 pm | Permalink

    Never mind. My Quicktime is playing up on my mac so loaded it up on my PC instead and hey presto its worked.

    This doesnt make PC’s better than Macs in anyway though lol.

  27. Noe
    Posted June 17, 2010 at 1:29 pm | Permalink

    Hi I write the code perfectly but i hate this error:
    Code Sign error: The identity ‘iPhone Developer’ doesn’t match any valid certificate/private key pair in the default keychain

    Is it real that i need to get the paid version?
    or i can correct that?

  28. CJ
    Posted June 24, 2010 at 11:32 am | Permalink

    Followed the tutorial and all I see is the court.png no ball or racquets. I’ve seen others with the same problem and they said they fixed it but how did they do it?

  29. Anonymous
    Posted June 27, 2010 at 5:38 am | Permalink

    Just to let everybody who is having the problem when they link to the File’s Owner, you must select the object e.g the racquet, then drag the line across.

  30. Anonymous
    Posted June 27, 2010 at 6:38 am | Permalink

    Hi

    Easy to understand tutorial, well done!

    However, when I do build and go, I get 18 errors, I deleted most of the stuff where the errors were coming from but I think they were the most important bits, but I wanted to try build and go again, but I got one error saying:

    Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

    Any ideas what I might be doing wrong?

    J.F

    • Camel
      Posted July 1, 2010 at 1:55 pm | Permalink

      @those where only the court shows up.

      I had the same problem and solved it like this.

      Open the interface builder. In the window with 3 icons (File’s owner, First Responder, View), click on the View icon.
      Go to the View Connections tab and make a new connection to the File’s Owner.

  31. Camel
    Posted July 1, 2010 at 1:57 pm | Permalink

    @those where only the court shows up.

    I had the same problem and solved it like this.

    Open the interface builder. In the window with 3 icons (File’s owner, First Responder, View), click on the View icon.
    Go to the View Connections tab and make a new connection to the File’s Owner.

  32. ashok yagnik
    Posted July 5, 2010 at 12:43 pm | Permalink

    hi
    suddenly i am facing problems with my iphons games that is wheneevr i click on the game icon for a second it opens a game but automatically it gets close so please help me with it

  33. Posted July 22, 2010 at 1:57 am | Permalink

    So nice tutorial , I can run this game on iphone simulator successfully. Thank you very much

  34. Xander PK
    Posted July 23, 2010 at 2:20 am | Permalink

    hey where’s the part 2 of the tutorial ???
    X-(

    PS. part 1 was really great! :D

  35. Giovanni Di Russo
    Posted July 30, 2010 at 5:25 pm | Permalink

    Hi, great tutorial! I want to know one thing for future reference, though: what (if any) is the difference between UIImage and UIImageView? I know this is a simple question, but I would greatly appreciate an answer.

    • andy
      Posted August 31, 2010 at 2:49 pm | Permalink

      your a douche

      • joe
        Posted August 31, 2010 at 2:50 pm | Permalink

        andy thats not nice

  36. Gio
    Posted July 31, 2010 at 11:49 am | Permalink

    Sorry to double post, but there is a problem with mine:
    when I run it, the ball moves even though it is paused and clicking the screen on the simulator does not get rid of the label. Any help would be very appreciated.

  37. andy
    Posted August 31, 2010 at 2:48 pm | Permalink

    how do you put this on the iphone/itouch

  38. joe
    Posted August 31, 2010 at 2:53 pm | Permalink

    cool andy that is so cool it smells like chocolate and limes at the same time

  39. Eddie
    Posted September 19, 2010 at 7:45 am | Permalink

    Thanks a lot for this article! You might want to add: For people who do not own a Mac, you can install Mac OS Snow Leopard in a virtual environment with VirtualBox and get this to work. Google “mac os snow leopard virtualbox”.

  40. Dave
    Posted September 23, 2010 at 10:26 am | Permalink

    Hey, any1 got the links to the other parts of this? Would be greatly appreciated :D

  41. Dave
    Posted September 23, 2010 at 10:26 am | Permalink

    Hey, any1 got the links to the other parts of this? Would be greatly appreciated :D

  42. Neil Cooper
    Posted October 13, 2010 at 11:31 am | Permalink

    Brandon
    Can you please help. I have got to the first stage of your tutorial where you add the court.png image but no files appear in the drop down menu. On looking at previous questions I see that others have had this problem but I have tried saving and even doing the whole thing from scratch again but I just cannot get this image to go to view. Any suggestions as to what I am doing wrong? Regards Neil

  43. diaz
    Posted October 14, 2010 at 5:21 am | Permalink

    i got a problem with the interface built, cause the video you provide cut off when add UILabel “taptobegin”. The rest of the video is missing. Please tell me what the rest contain.
    ^^

  44. Dr. Rolf R. Fink
    Posted October 14, 2010 at 11:11 pm | Permalink

    Good stuff, but where is part two ?

  45. Unixx
    Posted October 23, 2010 at 3:28 am | Permalink

    10x but the video file for the outlets connections is missing!!

  46. Posted October 25, 2010 at 8:43 pm | Permalink

    Excellent and unselfish tutorial! Great Stuff!

  47. Johnny6
    Posted November 4, 2010 at 2:48 pm | Permalink

    Love this cant wait to see more

  48. Vishakha
    Posted November 17, 2010 at 1:36 am | Permalink

    I have completed the tutorial and build and run successfully.But my problem is when I click on Tap To Begin Label,the ball starts moving but can’t stop it once it started moving and the racquets are not moving also the player’s and computers score’s are still the same as 0. Can you please help me to solve this problem or we need to write code for this to work properly ?

  49. Joe
    Posted November 27, 2010 at 4:44 pm | Permalink

    Hey man great tutorial, but I got all these errors saying kballspeed undefined, or gameloop undefined, how can i fix that?

    thanks

  50. Bob
    Posted November 29, 2010 at 5:20 pm | Permalink

    Hey! wasnt sure of you where answering questions via email, but i had to try…
    i finished the tutorial and when i attempt to simulate the game it immediately exits back to the menu.. this is my first game so maybe its a setting?

    • Posted December 5, 2010 at 4:07 am | Permalink

      @Bob,

      You may have made the same mistake as me:

      In the viewDidLoad function I had:

      selector:@selector(gameloop)

      instead of:
      selector:@selector(gameLoop)

      (lowercase ‘l’ instead of uppercase ‘L’.

      Changing to the correct case sorted the problem.

      Cheers,

      Martin.

41 Trackbacks

    Post a Comment

    Your email is never published nor shared. Required fields are marked *

    *
    *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">