gpt4 book ai didi

objective-c - 如何更改 Apple 示例代码项目 MoviePlayer

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

在 Apple 示例代码项目:MoviePlayer 中,我想实现的是,当示例 App 启动时,本地视频会立即以编程方式播放。

我加上最后两句:

[self.tabBarController setSelectedIndex:1];
[self performSelector:@selector(playMovieButtonPressed:) withObject:tabBarController.selectedViewController afterDelay:0.0];

在下面的函数中:

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
/* Override point for customization after app. launch. */

/* Add the tab bar controller's current view as a subview of the window. */
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
[self.tabBarController setSelectedIndex:1];
[self performSelector:@selector(playMovieButtonPressed:) withObject:tabBarController.selectedViewController afterDelay:0.0];
}

但出现以下错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyLocalMovieViewController playMovieButtonPressed]: unrecognized selector sent to instance 0x6190330'

请帮忙,谢谢!

最佳答案

您需要获取指向您的 MyLocalMovieViewController 的指针,然后执行类似

的操作
[pointer playMovieButtonPressed:nil]

关于objective-c - 如何更改 Apple 示例代码项目 MoviePlayer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10698550/

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