How do you connect a button to a seperate window?

Discussion in 'iOS Development' started by peebrian202869, Apr 14, 2010.

  1. peebrian202869

    peebrian202869 Banned

    Joined:
    Nov 28, 2009
    Messages:
    2,061
    Likes Received:
    1
    Device:
    3G iPod touch
    Nooby Questions:
    How do you connect a button to a seperate window?
    If you want to make an image view then where do you place the image in Xcode?
    How do you make a button play a sound and where do you place that sound in Xcode?

    I own a MacBook with iPhone SDK 3.1.3 (not registered)

    Thankyou!
  2. toloratedmeat

    toloratedmeat New Member

    Joined:
    Mar 19, 2008
    Messages:
    43
    Likes Received:
    0
    Device:
    iPhone 3GS (White)
    Erm. Go into the .h file and declare the window in @interface. Then add your IBAction under it.

    Put it in Resources.

    Put it in resources and use the following code.

    Code:
    
    {
    	//Get the filename of the sound file:
    	NSString *path = [NSString stringWithFormat:@"%@%@",
    					  [[NSBundle mainBundle] resourcePath],
    					  @"/sound.wav"];
    
    	//declare a system sound id
    	SystemSoundID soundID;
    
    	//Get a URL for the sound file
    	NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
    
    	//Use audio sevices to create the sound
    	AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
    
    	//Use audio services to play the sound
    	AudioServicesPlaySystemSound(soundID);
    }
    
    
    Hope this helped.
  3. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    What does that mean?

    also, use -[NSBundle pathForResource] instead of the format string approach outlined above.
  4. maxk96

    maxk96 New Member

    Joined:
    Jul 8, 2009
    Messages:
    37
    Likes Received:
    0
    Device:
    2G iPod touch

Share This Page