0

I would like to create an array of images that show the alphabet and can play a sound when tapped on the image for instance I would like to show the letter A image and the user tap the letter a and it say " This is the letter A" then proceed to the next letter.

So far I have the code for the array

var alphaImage: [UIImage] = [

UIImage(named: "alphaA.png);
UIImage(named: "alphaB.png);
...

is this a good start and how can I incorporate the sound for each, should I do a mulitple views project or a single page project?

Thanks

Ekta Padaliya
  • 5,743
  • 3
  • 39
  • 51

1 Answers1

1

try this code

var alphaImage: Array<UIButton> = [UIButton]()

alphaImage.append(UIButton())

for img in alphaImage
{
    img.setBackgroundImage(UIImage(named: "image"), forState: UIControlState.Normal)
    img.addTarget( self, action: "method", forControlEvents: UIControlEvents.TouchUpInside)
}

func method()
{
    //
    play sound here
}
Muhammed
  • 584
  • 1
  • 11
  • 24