Created
August 2, 2012 00:34
-
-
Save jonahsiegle/3231917 to your computer and use it in GitHub Desktop.
fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)playPause:(id)sender { | |
player = [MPMusicPlayerController applicationMusicPlayer]; | |
if ([songs count] > 0) { | |
if (isPlaying) { | |
NSLog(@"Playing music"); | |
[player pause]; | |
[sender setTitle:@"Pause" forState:UIControlStateNormal]; | |
isPlaying = NO; | |
} else{ | |
NSLog(@"Music paused."); | |
[player play]; | |
[sender setTitle:@"Play" forState:UIControlStateNormal]; | |
isPlaying = YES; | |
} | |
} else { | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Uh oh!" message:@"You forgot to select some music!" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; | |
[alert show]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment