1

在 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];
}

但得到以下错误:

由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[MyLocalMovieViewController playMovieButtonPressed]:无法识别的选择器发送到实例 0x6190330”

请帮忙,谢谢!

4

1 回答 1

2

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

[pointer playMovieButtonPressed:nil]
于 2012-05-23T06:09:00.870 回答