iOS Guides | Samples

MonoTouch.UIKit.UIActivity Class

Abstract base class of activities to which the UIActivityViewController can send data.

See Also: UIActivity


[MonoTouch.Foundation.Register("UIActivity", true)]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 6, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.TvOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
public class UIActivity : NSObject

See Also


The UIActivityViewController can be used to send data to services such as social networks, email, SMS, etc. The operating system provides a number of these, such as UIActivityType.PostToFacebook, UIActivityType.Mail, and UIActivityType.Message.

You can create a new service by subclassing UIActivity and, optionally, UIActivityItemProvider. This service will only be available to your own application; there is no way to make for non-Apple developers to make a UIActivity that is available across apps.

When subclassing, you should override the UIActivity.Image, UIActivity.Title, UIActivity.Type, UIActivity.Prepare and UIActivity.CanPerform.

c# Example

// Share an image 
var imageToShare = UIImage.FromFile ("demo.png");
var activityItems = new NSObject[] { imageToShare };
var controller = new UIActivityViewController (activityItems, null);
this.PresentViewController(controller, true, null)

// Now share the image, but explicitly exclude posting as a message
controller = new UIActivityViewController (activityItems, null) {
    ExcludedActivityTypes = new NSString[] {
this.PresentViewController(controller, true, null)

Related content


Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions:

The members of MonoTouch.UIKit.UIActivity are listed below.

See Also: NSObject

Public Constructors

Default constructor, initializes a new instance of this class.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

CategoryUIActivityCategory. The category of the UIActivity, which may be used to group activities in the UI.
ClassHandleIntPtr. The handle for this class.
ImageUIImage. An image that identifies the service to the app user.
TitleString. A string describing the service to the app user.
TypeNSString. Identifier for the service provided.
ViewControllerUIViewController. The UIViewController to present to the app user.

Public Methods

CanPerform(NSObject[]) : Boolean
Whether the service can act on the specified data items.
Notifies the system that this UIActivity has completed its work.
Performs the service when no custom UIViewController is provided.
Prepares the service to act on the specified data.