gpt4 book ai didi

ios - AVPictureInPictureController - 自定义 PopOver 不显示

转载 作者:行者123 更新时间:2023-11-28 16:16:08 30 4
gpt4 key购买 nike

我在AVPPlayer中使用了AVPictureInPictureController,并将其初始化为AVPlayerLayer。

- (id)initWithFrame:(CGRect)frame contentURL:(NSURL*)contentURL
{
self = [super initWithFrame:frame];
if (self) {

AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:contentURL];
self.moviePlayer = [AVPlayer playerWithPlayerItem:playerItem];
playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.moviePlayer];

if ([AVPictureInPictureController isPictureInPictureSupported])
{
self.avVPictureInPictureController = [[AVPictureInPictureController alloc] initWithPlayerLayer:playerLayer];
}


[playerLayer setFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];


[self.moviePlayer seekToTime:kCMTimeZero];
[self.layer addSublayer:playerLayer];


self.contentURL = contentURL;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerFinishedPlaying) name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem];

[self initializePlayer:frame];
}
return self;
}

现在当我尝试呈现 FPPopoverController (在 iPhone 和 iPad 上显示 PopOver 的自定义类)它不显示在屏幕上。

我使用下面的代码来呈现 FPPopOverController

//That's how I call

self.audioSubtitlePopoverController.presentPopoverFromPoint(point)


//Definition of presentPopoverFromPoint

-(void)presentPopoverFromPoint:(CGPoint)fromPoint
{
self.origin = fromPoint;

//NO BORDER
if(self.border == NO)
{
_viewController.title = nil;
_viewController.view.clipsToBounds = YES;
}

_contentView.relativeOrigin = [_parentView convertPoint:fromPoint toView:_contentView];

[self.view removeFromSuperview];
NSArray *windows = [UIApplication sharedApplication].windows;
if(windows.count > 0)
{
_parentView=nil;
_window = [windows objectAtIndex:0];
//keep the first subview
if(_window.subviews.count > 0)
{
_parentView = [_window.subviews lastObject];

NSLog(@"%@ %@",_parentView,_viewController);
[_parentView addSubview:self.view];
[_viewController viewDidAppear:YES];
[self.view bringSubviewToFront:_parentView];

}

}
else
{
[self dismissPopoverAnimated:NO];
}



[self setupView];
self.view.alpha = 0.0;
[UIView animateWithDuration:0.2 animations:^{

self.view.alpha = self.alpha;
}];

[[NSNotificationCenter defaultCenter] postNotificationName:@"FPNewPopoverPresented" object:self];

//navigation controller bar fix
if([_viewController isKindOfClass:[UINavigationController class]])
{
UINavigationController *nc = (UINavigationController*)_viewController;
UINavigationBar *b = nc.navigationBar;
CGRect bar_frame = b.frame;
bar_frame.origin.y = 0;
b.frame = bar_frame;
}
}

即使从 View 中呈现也不起作用

self.audioSubtitlePopoverController.presentPopoverFromView(self.view)
// Definition of presentPopoverFromView
-(void)presentPopoverFromView:(UIView*)fromView
{
SAFE_ARC_RELEASE(_fromView);
_fromView = SAFE_ARC_RETAIN(fromView);
[self presentPopoverFromPoint:[self originFromView:_fromView]];
}

任何人都可以帮忙。将不胜感激。

最佳答案

FPPopover 已弃用。

你应该使用 native Possibility显示弹出窗口或 WEPopover相反。

关于ios - AVPictureInPictureController - 自定义 PopOver 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39064154/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com