カスタム QLPreviewController 実装があるため、ユーザーに表示されるボタンとそのアクションを制御できます。viewWillAppear
カスタム クラスのメソッドに次のコードを追加しました。
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(openWithPressed:)];
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissPressed:)];
[self.navigationItem setRightBarButtonItem:rightBarButtonItem];
[self.navigationItem setLeftBarButtonItem:leftBarButtonItem];
[rightBarButtonItem release];
[leftBarButtonItem release];
}
プレビューアにはカスタム ボタンが表示され、期待どおりに機能します。
ユーザーが「ホーム」ボタンをクリックすると、問題が発生します。UIApplication.doEvents
メソッドが set ボタン メソッドを呼び出し、navigationItem
元の値に (元のハンドラーを使用して) リセットするように継ぎ目があります。
これを防ぐにはどうすればよいですか、またはこれらのイベントを自分で処理して、独自のカスタム ボタンで上書きするにはどうすればよいですか?