Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials > Tutorial Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 08-14-2008, 05:57 PM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 1
RonnyBaywalds is on a distinguished road
Unhappy Play a Short Sound Tutorial: How Can I Use a Button?

The How to Play a Short Sound tutorial was great. Followed it step by step and got quick little app up and running in no time.

I'm still really new at this though and trying to figure out how to make a button inside the App play the sound as opposed to just pressing anywhere on the screen. I added a Round Rect button in Interface Builder, added an Outlet outlet in Mainview (catButton) and linked it to the button itself.

- (void)touchesBeganNSSet *)touches withEventUIEvent *)event {
[soundEffect play];

I'm assuming its somewhere in here that I change to make the sound play when the button is pressed instead of the background, but I'm stumped.

Any ideas?
RonnyBaywalds is offline   Reply With Quote
Old 08-14-2008, 08:27 PM   #2 (permalink)
mr.
 
refreshe's Avatar
 
Join Date: Jul 2008
Location: SF, California | Melbourne, Australia
Posts: 346
refreshe is on a distinguished road
Default

you wouldn't have to use the touchesBegan method for what you're trying to do.

you could simply create an IBAction that's called when the UIButton is pressed:

Code:
- (IBAction)playSound {

    [soundEffect play];
}
you can link connect that in Interface Builder with your button for "Touch Up Inside"
refreshe is offline   Reply With Quote
Old 03-12-2009, 06:35 PM   #3 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 1
gwsgws@gmail.com is on a distinguished road
Default Play short sound - sample code

Hi
Wondered if you might be able to advise where I can get a copy of the sample code from 'play short sound'.
Thanks and regards

Geoff stewart
gwsgws@gmail.com is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 175,696
Threads: 94,138
Posts: 402,957
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jasper_muc
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:52 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0