-2

私はこれに多くの問題を抱えており、この状況に対する具体的な答えを見つけることができないようです.

ボタンを持つ UITableViewController があり、クリックすると UIActionSheet にいくつかのオプションが表示されます。オプションの 1 つを使用して、ストーリーボードに既に表示されている別のビュー コントローラーを表示する準備ができていることを望みます。

UIActionSheet は完全に実装されており、そのactionSheet:clickedButtonAtIndex:中で何をすべきかわかりません。

私はその中にこれを入れてみました:

NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];

if ([buttonTitle isEqualToString:@"Text"]) {
    AddTextViewController *addTextViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"addTextViewController"];
    [self presentViewController:addTextViewController animated:YES];
}

しかし、次のようなエラーが表示No visible @interface for 'RootViewController' declares the selector 'presentViewController:animated:されるので、それも機能していません。

私はここで何をしているのですか?

4

1 に答える 1

2

などの方法はありませんpresentViewController:animated:。メソッドは実際にはpresentViewController:animated:completion:.

だから変更:

[self presentViewController:addTextViewController animated:YES];

に:

[self presentViewController:addTextViewController animated:YES completion:nil];

必要に応じて、実際の完了ブロックを渡します。

于 2013-03-18T15:57:57.320 に答える