弄清楚在UIActivityViewController中点击了哪个图标 [英] Figuring out which icon was clicked on in UIActivityViewController
问题描述
使用社交框架,在展示显示所有常用社交媒体图标的模式UIActivityViewController时,有没有办法找出用户点击的确切图标?意思是,如果他们选择Twitter,Facebook,Mail,Message等?
Using the "Social" Framework, when presenting the modal UIActivityViewController that displays all the usual social-media icons, is there a way to find out exactly which icon the user clicked on? Meaning, if they chose Twitter, Facebook, Mail, Message, etc?
我原本希望在Docs中看到这个类的一些委托方法,但我什么都看不到。
I was expecting to possibly see some delegate methods for this class in the Docs but I don't see anything.
有人有任何想法吗?
推荐答案
UIActivityViewController
有 completionHandler
属性。实现此处理程序以通知。
The UIActivityViewController
has the completionHandler
property. Implement this handler to be notified.
UIActivityViewController *avc = ...;
avc.completionHandler = ^(NSString *activityType, BOOL completed) {
if (completed) {
NSLog(@"The selected activity was %@", activityType);
}
};
这篇关于弄清楚在UIActivityViewController中点击了哪个图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!