gpt4 book ai didi

iOS 7 通知中心未调用

转载 作者:行者123 更新时间:2023-11-29 03:24:08 25 4
gpt4 key购买 nike

我已经使用这段代码来播放一些视频。并希望在完成播放时收到事件。但不使用通知中心获取事件。

我试过这段代码

    NSString * str=[[NSBundle mainBundle]pathForResource:@"iGreet" ofType:@"m4v"];

NSURL * url=[NSURL fileURLWithPath:str];

MPMoviePlayerController * movieController=[[MPMoviePlayerController alloc]initWithContentURL:url];
movieController.controlStyle=MPMovieControlStyleFullscreen;
[movieController.view setFrame:self.view.bounds];

[movieController setMovieSourceType:MPMovieSourceTypeFile];
movieController.shouldAutoplay=YES;

[self.view addSubview:movieController.view];
[movieController setFullscreen:YES animated:YES];
[movieController play];


[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onStop:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:movieController];

}

-(void)onStop:(NSNotification*)notification
{


}

最佳答案

更改为:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onStop:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:movieController];

-(void)onStop:(NSNotification*)notification
{


}

它对我有用。

关于iOS 7 通知中心未调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20700852/

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