如何在uiscrollview中滑动图像时添加短声音

时间:2012-06-05 04:46:55

标签: iphone ios uiscrollview audio

  

可能重复:
  how to add short sounds while swiping images in uiscrollview

这是我的代码

这里我想在滑动图像时添加声音。

int x,y,count;
    but=[[NSMutableArray alloc]initWithObjects:[UIImage imageNamed:@"top2.png"],[UIImage imageNamed:@"top1.png"],[UIImage imageNamed:@"top3.png"],[UIImage imageNamed:@"top4.png"],[UIImage imageNamed:@"top5.png"],[UIImage imageNamed:@"top6.png"],[UIImage imageNamed:@"top7.png"],[UIImage imageNamed:@"top8.png"],nil];

    x=0;
    y=0;
    count=0;
    for (int i=0; i<=7; i++) {
        count++;
        for (int i=7; i>=0; i--) {
            count--;

            UIButton *but2=[[UIButton alloc]initWithFrame:CGRectMake(x, y, 320, 141)];

            //[but setImage:[UIImage imageNamed:@"mzl.jpg" ]forState:UIControlStateNormal];
            [but2 setImage:[but objectAtIndex:i] forState:UIControlStateNormal];
            NSLog(@"%@",but);

            x=x+320;
            // x=0;
            //y=0;

            if(count==8)
            {
                //count++;
            }
            //[scr addSubview:images];
            //[images release];
            [scrollview1 addSubview:but2];
        }
    }
    scrollview1.pagingEnabled=TRUE;
    [scrollview1 setContentSize:CGSizeMake(x, y)];

0 个答案:

没有答案