通知中心-在音乐软件中的应用
来源:互联网 发布:淘宝交易额 英文 编辑:程序博客网 时间:2024/04/30 03:05
首先要先设置一个继承与UIView的一个类,类中包含歌手图片,歌曲,歌手,上一曲和下一曲暂停的view --
PlayView
然后在appdelegate中设置一个属性,属性的类属于
PlayView
在-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[_window release];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(musicChange:) name:@"change" object:nil];
[center addObserver:self selector:@selector(hidden:) name:@"hidden" object:nil];
[center addObserver:self selector:@selector(didHidden:) name:@"didHidden" object:nil];
self.playView = [[PlayView alloc] initWithFrame:CGRectMake(0, self.window.frame.size.height - 60, self.window.frame.size.width, 75)];
self.playView.backgroundColor = [UIColor cyanColor];
self.playView.alpha = 0.5;
self.playView.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
[self.playView addGestureRecognizer:tap];
}
- (void)tap:(UITapGestureRecognizer *)tap
{
self.play = [PlayViewController sharePlayVC];
[_homeview presentViewController:self.play animated:YES completion:^{
}];
}
- (void)hidden: (NSNotification*)noti
{
self.playView.hidden = NO;
}
- (void)didHidden:(NSNotification *)noti
{
self.playView.hidden = YES;
}
-(void)musicChange:(NSNotification *)noti
{
self.playView.detail = noti.object;
NSLog(@"%@",noti.object);
}
- (void)ReturnButton: (UIButton*)button
{
NSDictionary *notidic = [NSDictionary dictionaryWithObjectsAndKeys:@"value",@"key", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"hidden" object:@"dddd" userInfo:notidic];
[self dismissViewControllerAnimated:YES completion:^{
}];
}
- 通知中心-在音乐软件中的应用
- 通知中心在音乐播放器中的应用
- OC-通知中心应用
- CIT模拟器在呼叫中心中的应用
- 通知中心NSNotificationCenter应用总结
- AIDL在音乐播放器中的应用
- 初识iOS中的通知中心
- linux notify 通知在TP中的应用
- 获取应用在ios系统通知中心的设置?开启:关闭
- IOS中通知中心NSNotificationCenter应用总结
- iOS中通知中心NSNotificationCenter应用总结
- iOS中通知中心NSNotificationCenter应用总结
- iOS中通知中心NSNotificationCenter应用总结
- 初识iOS中的通知中心【图文+视频】
- iOS 8中的通知中心快速回复
- ios中的夜间模式(通知中心)
- 关于iOS中的通知中心(NSNotificationCenter)
- Day0823_将音乐库中的音乐在Service中异步加载, 播放音乐并设置到通知栏
- 判别式模型与生成式模型
- Sicily 1176 Two Ends
- 树链剖分--利用数据结构维护一棵树
- Xampp配置
- Merge Sorted Array——算法练习
- 通知中心-在音乐软件中的应用
- Java 中 Vector、ArrayList、List 使用深入剖析
- SD卡路径问题以及如何获取SDCard 内存
- Oracle创建删除用户、角色、表空间、导入导出、...命令总结
- iOS id和instancetype
- 文章标题
- 内连函数
- JAVA发送HTTP请求经典收藏
- jquery mobile 中的导航条