TSPopover を iPad アプリ (XCode 4.6、UITabBarController を使用したストーリーボード、iOS 6.2) に組み込んでいます。TSPopover コードをアプリにコピーし、最初にコントローラーを 1 つ選択しました。あるシーンでは、ユーザーが助けが必要なときにタップするための小さな「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:]: unrecognized selector sent to instance 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 libc++abi.dylib: 例外をスローして呼び出された終了
私が抱えている問題は、これを機能させるためにすべてが正しく接続されているかどうかわからないことです。私を導く TSPopover コードにはコメントがないので、何が必要かを推測しています。私はGoogleとSOを調べました...何もありません!実行時クラッシュの原因は何ですか? どうすれば修正できますか?