UIKit.UIActivityViewController Class
A standard view controller that connects the application to a number of standard services such as social networks, SMS, etc.

See Also: UIActivityViewController Members

Syntax

[Foundation.Register("UIActivityViewController", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_6_0)]
public class UIActivityViewController : UIViewController

Remarks

The UIKit.UIActivityViewController allows the application user to easily share data between the current application and services. A number of services such as social networks, email, and SMS are provided by the OS. The application developer can create additional services by implementing custom UIKit.UIActivitys and UIKit.UIActivityItemProvider. Custom activities are not available in other applications.

The following example shows how to use the UIKit.UIActivityViewController. In response to a button press, text from a UIKit.UITextField is made available to the UIKit.UIActivityViewController. The text is wrapped in the UIKit.UIActivityitem and this, in turn, is placed into the activityItems array. The application does not have custom UIKit.UIActivitys, so the applicationActivities array is specified as null. The UIKit.UIActivityViewController is allocated and presented modally with UIViewController.PresentViewController, which is appropriate for the iPhone. On the iPad, a UIKit.UIPopoverController should be used. The image shows the UIKit.UIActivityViewController during presentation.

C# Example

sendButton.TouchUpInside += (sender, e) => {
	var item = UIActivity.FromObject (textField.Text);
	var activityItems = new NSObject[] { item };
	UIActivity[] applicationActivities = null;
	
	var activityController = new UIActivityViewController (activityItems, applicationActivities);
	
	PresentViewController (activityController, true, null);
};
      

Related content

Requirements

Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0