gpt4 book ai didi

iPhone - 将视频显示为启动画面

转载 作者:行者123 更新时间:2023-12-03 20:16:24 24 4
gpt4 key购买 nike

我需要在我的 iPhone 应用程序中将视频显示为闪屏我正在使用以下代码:

-(void)setupMovie{
NSString* moviePath = [[NSBundle mainBundle] pathForResource:@"iphone" ofType:@"mp4"];
NSURL* movieURL = [NSURL fileURLWithPath:moviePath];

playerCtrl = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
playerCtrl.scalingMode = MPMovieScalingModeFill;
playerCtrl.controlStyle = MPMovieControlStyleNone;
playerCtrl.view.frame = CGRectMake(0, 0, 480, 320);

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification object:nil];

[playerCtrl.view setCenter:CGPointMake(240, 160)];
[playerCtrl.view setFrame:CGRectMake(0, 0, 480, 320)];
[playerCtrl.view setTransform:CGAffineTransformMakeRotation(-M_PI/2)];
[self.window addSubview:playerCtrl.view];
[playerCtrl play];}

但玩家 View 并非从 x=0,y=0 位置开始。这是什么原因以及如何解决。它的起始 x=100,y=100(大约)。

最佳答案

您正在设置影响位置3次的信息

playerCtrl.view.frame = CGRectMake(0, 0, 480, 320);
[playerCtrl.view setCenter:CGPointMake(240, 160)];
[playerCtrl.view setFrame:CGRectMake(0, 0, 480, 320)];

所以一个接一个地尝试

关于iPhone - 将视频显示为启动画面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4575273/

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