0

我正在尝试将 TSPopover 合并到我的 iPad 应用程序中(XCode 4.6,带有 UITabBarController 的 Storyboards,iOS 6.2)。我已将 TSPopover 代码复制到我的应用程序中,并选择了一个控制器作为开始。在一个场景中,我有一个圆圈中的小“i”供用户在需要帮助时点击(它最终会被本地化,因此需要帮助)。所以,我在-viewDidLoad中有这段代码:

    if(tfShopOpens.text.length == 0 || shopCloses.text.length == 0)  {
/*  (below code copied from the TSPopover demo code)
 UIButton *topButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

 [topButton addTarget:self action:@selector(showPopover:forEvent:) forControlEvents:UIControlEventTouchUpInside];

 topButton.frame = CGRectMake(10,10, 300, 30);
 [topButton setTitle:@"button" forState:UIControlStateNormal];
 topButton.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
 [self.view addSubview:topButton];
 */

 [boHelpStoreHours addTarget:self action:@selector(showPopover:forEvent:) forControlEvents:UIControlEventTouchUpInside];

这是来自 .h 文件:

- (IBAction)bHelpStoreHours:(UIButton *)sender;
@property (strong, nonatomic) IBOutlet UIButton *boHelpStoreHours;

这是来自连接检查器:

在此处输入图像描述

这是我点击此特定按钮时遇到的错误:

2013-04-02 15:49:48.016 saori[5495:c07]-[PreferencesViewController bHelpStoreHours:]:无法识别的选择器发送到实例 0x8a6c510 2013-04-02 15:49:48.019 saori[5495:c07] * 终止应用程序uncaught exception 'NSInvalidArgumentException', reason: '-[PreferencesViewController bHelpStoreHours:]: unrecognized selector sent to instance 0x8a6c510' * First throw call stack: (0x26fc012 0x19eae7e 0x27874bd 0x26ebbbc 0x26eb94e 0x19fe705 0x9322c0 0x932258 0x9f3021 0x9f357f 0x9f26e8 0x961cef 0x961f02 0x93fd4a 0x931698 0x2b79df9 0x2b79ad0 0x2671bf5 0x2671962 0x26a2bb6 0x26a1f44 0x26a1e1b 0x2b787e3 0x2b78668 0x92effc 0x222d 0x2155 0x1) libc++abi.dylib:终止调用抛出异常

我遇到的问题是我不确定一切都正确连接以使这项工作。TSPopover 代码中没有任何注释可以指导我,所以我猜测需要什么。我看过谷歌,所以......什么都没有!是什么导致运行时崩溃?我该如何解决?

4

1 回答 1

1

您的bHelpStoresHours:方法可能不存在于您的@implementation. 确保您已在PreferencesViewController.m文件中定义方法。

于 2013-04-03T00:18:54.867 回答