そこで、ストーリーボードファイルなどを設定し、UIBarButtonのアクションを作成しました。この方法では、アクションシートを作成して表示します。しかし、私が何をしても、常に下から表示されるようです。クリックしたボタンを指す境界線に小さな矢印が付いたナビゲーションバーからポップダウンすることはできませんか?まあ、私は正しい方法を見つけるのに苦労しています。これが私が試したことです:
- (IBAction)actionBtnPressed:(UIBarButtonItem *)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Options" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Report User" otherButtonTitles: nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showFromBarButtonItem:sender animated:YES];
}
私も試しました
[actionSheet showFromToolbar:self.navigationController.toolbar];
showFromBarButtonItemの代わりに、これらのメソッドは、ボタンから表示したいという私の心を読み取っていません。何か案は?