在每个View IOS的底部显示音乐播放器 [英] Show Music Player On Bottom of Every View IOS
问题描述
我正在创建一个IOS应用,我想在每个视图的底部显示音乐播放器实例.
I am creating an IOS app and I want to show music player instance on the bottom of every view.
赞这个图片
推荐答案
使用基本的ViewController,以编程方式仅创建底部音乐播放器视图,然后从基本ViewController扩展所有ViewController.因此,您所有的viewcontroller都将获得相同的底部播放视图.
Take a base viewcontroller which will programatically create only bottom music player view, then extend all you viewcontroller from the base viewcontroller. thus all of your viewcontroller will get the same bottom play view.
当心,所有viewcontroller都会有不同的底视图实例,您需要不断更新所有底播放器视图.一种巧妙的方法是使用NSNotification
Beware, all viewcontroller will different instance of the bottom view, you need to keep update all the bottom player view. A neat way to do that is using NSNotification
命名为@"backgroundImageChanged" NSNotification
侦听背景图像中的任何更改.应用程序内部触发的所有NSNotification
都将由该观察器侦听,并相应地更改背景图像.
Any change in the background image is listened by the @"backgroundImageChanged" NSNotification
named. Any NSNotification
fired inside the application is listened this observer and background image is changed accordingly.
这篇关于在每个View IOS的底部显示音乐播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!