播放音乐
1.找到文件路径
NSString *path=[[NSBundle mainBundle] pathForResource:@"灵魂尽头" ofType:@"mp3"];
self.play=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
2.播放
[self.play play];
[_play release];
毛玻璃效果
1.创建一个imageview添加毛玻璃效果
UIImageView *imageview=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"0.jpg"]];
imageview.frame=CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:imageview];
[imageview release];
2.创建一个毛玻璃效果
UIBlurEffect *effect=[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
3.创建一个毛玻璃视图.指定效果
UIVisualEffectView *efficview=[[UIVisualEffectView alloc] initWithEffect:effect];
4.另效果大小与imageview大小相同
efficview.frame=imageview.frame;
5.把效果添加给imageview
[imageview addSubview:efficview];
iOS播放音乐,毛玻璃效果
最新推荐文章于 2021-01-24 02:09:31 发布