Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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 在Ipad上使用UITableview Longpress手动操作动作表的最佳方式是什么_Ios_Swift - Fatal编程技术网

Ios 在Ipad上使用UITableview Longpress手动操作动作表的最佳方式是什么

Ios 在Ipad上使用UITableview Longpress手动操作动作表的最佳方式是什么,ios,swift,Ios,Swift,我有一个tableview,长按时会显示警报。它在iphone上运行良好,但在ipad上却出现了popover错误。问题是,表格不是按钮,我的单元格上没有按钮。解决这个问题的最佳方法是什么?请看一下我的代码 func ipadPresentationAlert(button:UIButton, alertController:UIAlertController){ if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pa

我有一个tableview,长按时会显示警报。它在iphone上运行良好,但在ipad上却出现了popover错误。问题是,表格不是按钮,我的单元格上没有按钮。解决这个问题的最佳方法是什么?请看一下我的代码

 func ipadPresentationAlert(button:UIButton, alertController:UIAlertController){
        if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad ){
            if let currentPopoverpresentioncontroller = alertController.popoverPresentationController{
                currentPopoverpresentioncontroller.sourceView = button
                currentPopoverpresentioncontroller.sourceRect = button.bounds;
                currentPopoverpresentioncontroller.permittedArrowDirections = UIPopoverArrowDirection.up;
                self.present(alertController, animated: true, completion: nil)
            }
        }else{
            self.present(alertController, animated: true, completion: nil)
        }
    }

你可以用你的手机替换你的按钮

按钮:UIButton->单元格:UITableViewCell

在iPad上,ActionSheet需要显示一个sourceView,这样你就可以把你的手机放在这里作为一个支点

currentPopoverpresentioncontroller.sourceView = cell

你能显示你的错误日志吗?你的代码中的按钮是什么?如果你没有按钮,为什么里面有一个按钮变量?我想你只需要填一下你的手机就可以了。按钮:UIButton->cell:UITableViewCell。为什么不同的设备有不同的代码?只要在所有设备上使用与iPad代码相同的代码即可。iOS会做正确的事情。