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 Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-11-2010, 02:12 PM   #1 (permalink)
Registered Member
 
bladeolson's Avatar
 
Join Date: Aug 2008
Posts: 31
bladeolson is on a distinguished road
Send a message via AIM to bladeolson
Default Newbie question about methods?

I have created an app that is basically a view based app with a scroll view. I was able to get 15 views loaded into my scrollview and I can page from view to view. I made a class for each of these views as I figure each would have their own set of instruction... The scrolling part It works great.....

Trouble I am having is that i want to "trigger" things to happen when different views are shown. I am able to get methods to work when I tie them to a button on interface builder, but how do I make stuff happen "automaticallty" ?

On my Page1View.m ( the first view of the scrollview) :

I have 2 methods:

How do I get the setUpSounds to "trigger" ? If I add [self setUpSounds] to the IBAction I made, I can get it to initialize the sounds, then play it, but I want it to automatically initialize the sounds without a button.

I am sure it is something simple, that I just don't know. I can see that in the ViewController, I can get things to happen automatically if I place them in - (void)viewDidLoad { , but it does not work in my own UIVIew classes.

blade



Code:
-(void)setUpSounds {
	
	
	NSLog(@"sounds are setup");
    NSBundle *mainBundle = [NSBundle mainBundle];
	
    farSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"farSound" ofType:@"caf"]];
    nearSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"nearSound" ofType:@"caf"]];
    levelSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"levelSound" ofType:@"caf"]];
	
	
	
}


- (IBAction)playTheFarSound {
	
		
        [farSound play];
	
}
bladeolson is offline   Reply With Quote
Reply

Bookmarks

Tags
newbie, playing methods

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
» Online Users: 334
15 members and 319 guests
akphyo, alexP, appservice, cgokey, flamingliquid, guusleijsten, mariano_donati, ohmniac, Paul Slocum, PavelSea, SLIC, Sloshmonster, Sonuye857, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,653
Threads: 94,115
Posts: 402,888
Top Poster: BrianSlick (7,990)
Welcome to our newest member, ohmniac
Powered by vBadvanced CMPS v3.1.0

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