UIPasteboard Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Support for the system pasteboard for cut, copy and paste.
[Foundation.Register("UIPasteboard", true)]
public class UIPasteboard : Foundation.NSObject
[<Foundation.Register("UIPasteboard", true)>]
type UIPasteboard = class
inherit NSObject
- Inheritance
- Attributes
Remarks
Pasteboards
Pasteboards allow information to be shared across applications. The general pasteboard (accessible via the General property) is the system-wide pasteboard that applications use by default. Developers can also transfer information across their own applications (those that share their team ID) by creating their own pasteboards.
Setting Pasteboard Data
All operations that set the contents of the pasteboard clear any data that is currently stored there.
To set the pasteboard contents to NSString, NSArray, NSDictionary, NSDate, NSNumber, UIImage or NSUrl use the SetValue(NSObject, String) method.
To set the pasteboard contents to an image, use the Image. property.
To set the pasteboard contents to a set of images, use the Images. property.
To set the values to arbitrary data types, use the SetData(NSData, String) method.
You can use the convenience properties String, Strings, Image, Images, Url, Urls, Color and Colors to set and get strings, images, Urls or Colors on the pasteboard.
//
// Setting the contents of the pasteboard to "Hello World"
// by specifying the UTI type for text.
//
var text = new NSString ("Hello world")
UIPasteboard.General.SetValue (text, MonoTouch.MobileCoreServices.UTType.Text);
//
// Setting the contents of the pasteboard to "So hello"
// using the convenience property:
//
UIPasteboard.General.String = "So hello";
Pasteboard Types
Whenever possible, you should use an UTI type to set the type of the information that is being stored on the pasteboard. You can find a list of common iOS/Mac UTI types on the UTType type.
UTI types are merely strings separated by dots. For example the UTI type for an image is "public.image". Apple maintains the "public.*" directory of UTI types.
Apple recommends that if you need to use your own data type to use an inverse ___domain to name them. For example, "com.xamarin.t-shirt-application.sales-information".
Constructors
| Name | Description |
|---|---|
| UIPasteboard(NativeHandle) |
A constructor used when creating managed representations of unmanaged objects. Called by the runtime. |
| UIPasteboard(NSObjectFlag) |
Constructor to call on derived classes to skip initialization and merely allocate the object. |
Properties
| Name | Description |
|---|---|
| AccessibilityAttributedUserInputLabels | (Inherited from NSObject) |
| AccessibilityRespondsToUserInteraction | (Inherited from NSObject) |
| AccessibilityTextualContext | (Inherited from NSObject) |
| AccessibilityUserInputLabels | (Inherited from NSObject) |
| Automatic |
Key indicating that pasteboard types should have their Uniform Type Identifiers determined automatically. |
| ChangeCount | |
| ChangedNotification |
Notification constant for Changed |
| ChangedTypesAddedKey |
Represents the value associated with the constant UIPasteboardChangedTypesAddedKey |
| ChangedTypesRemovedKey |
Represents the value associated with the constant UIPasteboardChangedTypesRemovedKey |
| Class | (Inherited from NSObject) |
| ClassHandle |
The Objective-C class handle for this class. |
| Color | |
| Colors | |
| Count | |
| DebugDescription | (Inherited from NSObject) |
| Description | (Inherited from NSObject) |
| General | |
| Handle |
Handle (pointer) to the unmanaged object representation. (Inherited from NSObject) |
| HasColors | |
| HasImages | |
| HasStrings | |
| HasUrls | |
| Image | |
| Images | |
| IsDirectBinding | (Inherited from NSObject) |
| IsProxy | (Inherited from NSObject) |
| ItemProviders | |
| Items | |
| Name | |
| Persistent | |
| RemovedNotification |
Notification constant for Removed |
| RetainCount | (Inherited from NSObject) |
| Self | (Inherited from NSObject) |
| String | |
| Strings | |
| Superclass | (Inherited from NSObject) |
| SuperHandle |
Handle used to represent the methods in the base class for this NSObject. (Inherited from NSObject) |
| TypeListColor |
Represents the value associated with the constant UIPasteboardTypeListColor |
| TypeListImage |
Represents the value associated with the constant UIPasteboardTypeListImage |
| TypeListString |
Represents the value associated with the constant UIPasteboardTypeListString |
| TypeListURL |
Represents the value associated with the constant UIPasteboardTypeListURL |
| Types | |
| Url | |
| Urls | |
| Zone | (Inherited from NSObject) |