Learn to Code iOS Apps 4: Making It Beautiful

Discussion of the official tutorials published on raywenderlich.com. Please only discuss the official tutorials here - for general questions, use the General Discussion forum instead.

Learn to Code iOS Apps 4: Making It Beautiful

Postby rwenderlich » Fri Jan 11, 2013 6:15 pm

This is the official thread to discuss the following blog post: Learn to Code iOS Apps 4: Making It Beautiful
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
User avatar
rwenderlich
Site Admin
 
Posts: 2264
Joined: Thu Dec 23, 2010 4:14 pm
Has thanked: 28 times
Been thanked: 381 times

Re: iOS for High School Students: Making Your First iOS App:

Postby romox » Sat Jan 12, 2013 5:15 am

Oops!
Sorry, it seems that the page you are looking for does not exist.
Try searching to see if you can find it that way!
romox
Subscriber since Feb 11, 2014
Hacker
 
Posts: 38
Joined: Sat Jan 12, 2013 5:13 am
Has thanked: 3 times
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby RAGGED_BLADE » Sat Feb 02, 2013 4:13 am

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Time is up!"
message:[NSString stringWithFormat:@"You scored %i points",count]
delegate:self
cancelButtonTitle:@"Main Menu"
otherButtonTitles:nil];
[alert show];


On my end I have a main menu and I can press Play and the game will start and whatever how would I make the text that pops up after the time runs out be able to say Play Again or Main Menu?
Also how would I be able to add the same background color to the menu as in the game's interface?
Thanks in advance for the help!

-EDIT-

I did find out how to make another button, now I just need to know how to be able to link it to the Main Menu.

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Time is up!"
message:[NSString stringWithFormat:@"You scored %i points",count]
delegate:self
cancelButtonTitle:@"Play Again"
otherButtonTitles:@"Main Menu", nil];

[alert show];
RAGGED_BLADE
n00b
 
Posts: 1
Joined: Sat Feb 02, 2013 4:07 am
Has thanked: 0 time
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby howshin » Sat Feb 02, 2013 11:58 am

Great Tutorial!Thanks a lot
I am looking forward you can add another topic that how to save the highscore and show the highscore on the screen,that will help us a lot.
HowShin Wang
howshin
n00b
 
Posts: 1
Joined: Wed Jul 18, 2012 2:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby Antonyk86 » Wed Mar 27, 2013 3:28 pm

Awesome Tutorial! Great place to start when learning to code iOS Apps! So much easier then reading the mundane books! Thanks!
Antonyk86
n00b
 
Posts: 1
Joined: Wed Mar 27, 2013 3:26 pm
Has thanked: 1 time
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby RachnaAnil » Tue Apr 16, 2013 10:39 pm

You have done a terrific job with this tutorial. The images and the app looks absolutely superb when i completed it.

Just one thing that I noticed when running it is a particular scenario:
1. Suppose when the timer times down to 0, the background music has just a few seconds more to play
2. When we call backgroundMusic.play, since there are a few seconds of the music left, it just continues to complete playing it. So once it gets over, there is no background music till the 30 seconds are up.

So what i did is:
1. In the alertView:clickedButtonAtIndex, I stopped the background music playing using [backgroundMusic stop];
2. In setupGame, instead of [backgroundMusic play], I used backgroundMusic.currentTime = 0; [backgroundMusic play]; This causes the background music to start at the beginning each time.
User avatar
RachnaAnil
n00b
 
Posts: 2
Joined: Tue Apr 16, 2013 10:33 pm
Location: United States
Has thanked: 0 time
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby DARKUNIT22 » Tue Jun 11, 2013 4:41 am

When I try to build it after I have already added all the necessary AVAudioPlayer coding I get an error that is telling me that there is no visible @interface for AVAudioPlayer. I'm guessing there has to be something extra added to the header file?

Any help is great, I'm very new to this.

Thanks! :D
DARKUNIT22
n00b
 
Posts: 1
Joined: Sat Jun 08, 2013 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby Fenderkid » Tue Jun 18, 2013 11:00 pm

First off, the tutorial has been really awesome so I wanted to say thank you for that!

My problem now is I have four errors that are not allowing me to build and run my program. Everything was great up until I tried to add sound and now I am faced with these issues:

// 3
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];


I get an error: Use of undeclared identifier 'url' and I'm not sure why?

My second problem is:

buttonBeep = [self setupAudioPlayerWithFile:@"ButtonTap" type:@"wav"];
secondBeep = [self setupAudioPlayerWithFile:@"SecondBeep" type:@"wav"];
backgroundMusic = [self setupAudioPlayerWithFile:@"HallOfTheMountainKing" type:@"mp3"];


I get three errors (one per line) that are all the same.

No visible @interface for 'ViewController' declares the selector 'setupAudioPlayerWithFile:type:'

I have checked and rechecked my code to make sure I copied it correctly but I can't seem to spot what I am doing wrong here..any help would be immensely appreciated.

Thanks,

James
Fenderkid
n00b
 
Posts: 2
Joined: Tue Jun 18, 2013 10:54 pm
Has thanked: 1 time
Been thanked: 0 time

Re: iOS for High School Students: Making Your First iOS App:

Postby rcasey » Wed Jun 19, 2013 12:06 am

@Fenderkid

Double-check your viewDidLoad and setupAudioPlayerWithFile:type methods.

re: "undeclared identifier: url" error
url is defined after the "// 1" comment.
Code: Select all
// 1
  NSString *path = [[NSBundle mainBundle] pathForResource:file ofType:type];
  NSURL *url = [NSURL fileURLWithPath:path];  // <---- url declared here


Check the spelling of your setupAudioPlayerWithFile:type: method. Remember, Objective-C is case-sensitive.

If you're still stuck, post the contents of your viewDidLoad and setupAudioPlayerWithFile:type methods.

Good luck!
rcasey
Forum Subject Matter Expert
 
Posts: 1259
Joined: Fri Jul 01, 2011 6:50 pm
Has thanked: 2 times
Been thanked: 272 times

Re: iOS for High School Students: Making Your First iOS App:

Postby Fenderkid » Wed Jun 19, 2013 12:40 am

Thanks for the help!

Once I added the
Code: Select all
NSURL *url = [NSURL fileURLWithPath:path];
it solved all of the issues I was having but now a new one has popped up on me...

- (void) viewDidLoad

This line is now coming back with the error: use of undeclared identifier 'viewDidLoad'

This is really weird as the program ran find before I added the sound and it seems like if this was undeclared it would not have run at all.. I suppose its good to run into problems so I know how to solve them in the future but I'm a bit stumped at the moment on what I'm doing wrong.

I'm confused I guess on where I would declare this method at.

Thanks again!

James
Fenderkid
n00b
 
Posts: 2
Joined: Tue Jun 18, 2013 10:54 pm
Has thanked: 1 time
Been thanked: 0 time

Next

Return to Official Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests