-
Notifications
You must be signed in to change notification settings - Fork 145
floatWin
shixuemei edited this page Mar 15, 2017
·
7 revisions
效果图如下:
假设全屏显示的UIViewController对象为_playerVC,悬浮窗显示的UIViewController对象为_floatVC,播放器对象为player
- 在全屏UIViewController对象_playerVC中, 创建播放器对象player以及悬浮窗_floatVC,关键是需要将_playerVC设置给_floatVC,以便_floatVC得到_player对象
- (void)viewDidLoad {
[super viewDidLoad];
......
_floatVC = [[KSYFloatVC alloc] init];
_floatVC.playerVC = self;
}
- 在悬浮窗的UIViewController对象_floatVC中,将播放器对象player的view大小设置为悬浮窗大小,并将player.view添加至悬浮窗的UIView上即可
- (void)viewDidAppear:(BOOL)animated {
if(_playerVC && _playerVC.player)
{
[_playerVC.player.view setFrame: videoView.bounds];
[videoView addSubview: _playerVC.player.view];
}
}