如何在iOS上使用Xamarin发现用户选择的社交媒体?
请看下面的例子:
using (UIActivityViewController actController = new UIActivityViewController(activityTypes, null))
{
actController.ExcludedActivityTypes = new NSString[]
{
UIActivityType.AddToReadingList,
UIActivityType.AirDrop,
UIActivityType.AssignToContact,
UIActivityType.CopyToPasteboard,
UIActivityType.Print,
UIActivityType.SaveToCameraRoll
};
Version deviceVersion = new Version(UIDevice.CurrentDevice.SystemVersion);
if (deviceVersion >= iosVersion8) {
actController.PopoverPresentationController.SourceView = buttonView;
}
PresentViewController(actController, true, null);
}
答案 0 :(得分:0)
尝试设置完成处理程序,如下所示:
actController.CompletionHandler += (NSString arg1, bool arg2) => {
if (arg1.Equals(UIActivityType.PostToFacebook))
{
Console.Write ("YOU CHOOSE FACEBOOK!");
}
};