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

See Also: UIActivity Members

Syntax

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

See Also

UIActivityViewController

Remarks

The UIKit.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 UIKit.UIActivity and, optionally, UIKit.UIActivityItemProvider. This service will only be available to your own application; there is no way to make for non-Apple developers to make a UIKit.UIActivity that is available across apps.

When subclassing, you should override the UIKIt.UIActivity.Image, UIKIt.UIActivity.Title, UIKIt.UIActivity.Type, UIKIt.UIActivity.Prepare and UIKIt.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[] {
        UIActivityType.PostToWeibo,
        UIActivityType.Message
    }
};
this.PresentViewController(controller, true, null)

	

Related content

Requirements

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