///声音按钮
voiceBtn = [[UIButtonalloc] initWithFrame:CGRectMake(kScreenWidth/2+10, kScreenWidths*2 + 5, kScreenWidths, kScreenWidths)];
[voiceBtnsetImage:[UIImageimageNamed:@"icon_listen"] forState:UIControlStateNormal];
[voiceBtnsetImage:[UIImageimageNamed:@"icon_listen_ov"] forState:UIControlStateHighlighted];
[voiceBtnaddTarget:selfaction:@selector(voiceBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
/// 初始化一个可变数组
NSMutableArray *Array = [[NSMutableArrayalloc]init];
for (NSUInteger i =1; i < 4; i++) {
UIImage *imageName = [UIImage imageNamed:[NSStringstringWithFormat:@"listen_%zd.png",i]];
NSLog(@"%@",imageName);
[Array addObject:imageName];
}
voiceBtn.imageView.animationImages = Array;
voiceBtn.imageView.animationDuration = 2.0;
[bouncedView addSubview:voiceBtn];
网友评论