如何发现用户选择的社交媒体?

时间:2015-05-12 13:12:06

标签: ios xamarin

如何在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);
}

1 个答案:

答案 0 :(得分:0)

尝试设置完成处理程序,如下所示:

actController.CompletionHandler += (NSString arg1, bool arg2) => {
    if (arg1.Equals(UIActivityType.PostToFacebook))
    {
        Console.Write ("YOU CHOOSE FACEBOOK!");
    }
};