用OC写了个播放视频的,播放完毕后软键盘会跳出来关不掉,控制台输出:
Cocos2d: markedTextRange
Cocos2d: markedTextRange
Cocos2d: markedTextRange
- (void)play { NSString * url = [[NSBundle mainBundle] pathForResource:
“test” ofType:`“mp4”];
MPMoviePlayerViewController *playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:`selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];
EAGLView **view = ;
;
// ;
CGRect screen;
screen.origin.x = 0;
screen.origin.y = 0;
screen.size.width = 480;
screen.size.height = 320;
playerViewController.view.frame = screen;
// Add the view - Use these three lines for Cocos 2D X
// UIWindow** window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
// [window addSubview: playerViewController.view];
// [window makeKeyAndVisible];
//—play movie—
MPMoviePlayerController **player = ;
player.controlStyle = MPMovieControlStyleNone;
player.scalingMode = MPMovieScalingModeAspectFit;
;
}
- movieFinishedCallback: aNotification {
MPMoviePlayerController**player = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];
player.initialPlaybackTime =1;Use these three lines for Cocos 2D X
;
;
}@
如果把注释部分:
// Add the view
// UIWindow * window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
// [window addSubview: playerViewController.view];
// [window makeKeyAndVisible];
启用,返回的界面无法点击了(不会出现键盘)