Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 显示来自UIBarbuttonite问题的UIActionSheet_Ios_Uiactionsheet - Fatal编程技术网

Ios 显示来自UIBarbuttonite问题的UIActionSheet

Ios 显示来自UIBarbuttonite问题的UIActionSheet,ios,uiactionsheet,Ios,Uiactionsheet,所以我设置了我的故事板文件等等,并为我的UIBarButton做了一个动作。在这个方法中,我创建一个动作表并显示它。但似乎无论我做什么,它总是从底部显示。难道你不能让它从导航栏中弹出,在边框中有一个小箭头指向你点击的按钮吗?嗯,我很难找到正确的方法。以下是我尝试过的: - (IBAction)actionBtnPressed:(UIBarButtonItem *)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] in

所以我设置了我的故事板文件等等,并为我的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,但这些方法并没有读懂我的想法,我希望它从按钮上显示出来。有什么想法吗?

对于iPhone,操作表总是从屏幕底部显示。你的意思是一个只适用于iPad的
UIPopover
。但是,如果您想在应用程序中使用相同的功能,可以使用自定义popover。检查。它允许你在iPhone中创建弹出框,并且可以安全地用于在你的应用程序中绘制弹出框。您可以在此popover中显示所需的项目

这是iPhone还是iPad?iPhone,这对iPhone不起作用吗?不,它只在iPad上显示一个带箭头的popover。现在我觉得自己很傻。谢谢你的帮助。我要是早点知道就好了。我创造了我自己的小府绸,它可以正常工作,但我花了太多的时间做它。