这是我的代码
在这里,我想在滑动图像时添加声音。
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)];