【发布时间】:2020-05-06 07:52:03
【问题描述】:
我还没有实现 UIViewController 因为我已经从另一个类继承了,它给出的错误是 present is not a member of this class
func shareAppLink() {
let name = "http://aijaz.com"
let items = [name] as [Any]
let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
present(ac, animated: true)
}
【问题讨论】:
-
错误是什么?
-
错误:使用未解析的标识符“存在”。选择单元格时,我想在我的 UITableView 中显示共享菜单。
-
从哪里调用
shareAppLink()? -
在UITableView的didSelectRowAt函数中调用。这不是问题,它实际上调用的地方是如何显示共享按钮,因为在我的课堂上现在不是我正在使用的课堂的一部分。我们如何在没有 UIActivityController 的情况下使用 present 方法。
-
据我了解,您的
shareAppLink()函数有一个单独的类。您可以从didSelectRowAt调用它。你有没有在shareAppLink()函数类的顶部添加import UIKit?你可以尝试做self.present