我正在处理我的图像iOS应用程序,我刚刚添加了一个图像共享按钮,我想要排除一些共享类型的功能,但是当我在模拟器中运行时,所有功能都在那里。
这是我的代码......
let image = UIImage("b3")
let imageToShare = [image!]
let shareImage = UIActivityViewController (activity items:imageToShare,application Activities:nil)
shareImage.popoverPresentationController?.sourceView = self.view
self.present (shareImage,animated:true,completion:nil)
shareImage.excludedActivityTypes = [UIActivityType.print,UIActivityType. copyToPasteboard]
如何排除它们? 请提供任何建议
答案 0 :(得分:0)
只需更改excludedActivityTypes
UIActivityViewController
的顺序即可
像这样:
shareImage.excludedActivityTypes = [UIActivityType.print,UIActivityType.copyToPasteboard]
self.present (shareImage,animated:true,completion:nil)
答案 1 :(得分:0)
在设置excludedActivityTypes之前,您正在展示活动视图控制器。用以下代码替换您的代码:
var myFunctions = [];
function createMyFunction(i) {
return function() {
console.log("My value: " + i);
};
}
for (var i = 0; i < 3; i++) {
myFunctions[i] = createMyFunction(i);
}
for (var j = 0; j < 3; j++) {
myFunctions[j](); // and now let's run each one to see
}