Tutorial details

Playing A Sound | App Code for Sale | Preview

Playing A Sound | iOS Tutorial

How to play a sound file by a simple press of a button

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcodeplaysound.htm

In this tutorial i will be showing you how to play a sound file by a simple press of a button


  • 1 round rect button
  • wav audio file
  • audiotoolbox framework

Having sound in your application improves the fun and enterainment for your users and gets the most out of your app, By adding the audiotoolbox framework and your wav sound file to your project this enables you to play sound by a simple press of a button

ViewController.h PAGE TOP

#import <AudioToolbox/AudioToolbox.h>
@interface ViewController :UIViewController {
SystemSoundID SoundID;
- (IBAction)Button;

ViewContrller.m PAGE TOP

@implementation ViewController
- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSURL *buttonURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Sound" ofType:@"wav"]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)buttonURL, &SoundID);

- (IBAction)Button {

Reference PAGE TOP


0 Comments Leave a comment

Please login in order to leave a comment.

Newest first

to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.