Share via


UIPasteboard Class

Definition

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
UIPasteboard
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)

Methods

Name Description
AddItems(NSDictionary[])
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AwakeFromNib() (Inherited from NSObject)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
ConformsToProtocol(NativeHandle) (Inherited from NSObject)
Contains(String[], NSIndexSet)
Contains(String[])
Copy() (Inherited from NSObject)
DangerousAutorelease()

Calls the 'autorelease' selector on this object.

(Inherited from NSObject)
DangerousRelease()

Calls the 'release' selector on this object.

(Inherited from NSObject)
DangerousRetain()

Calls the 'retain' selector on this object.

(Inherited from NSObject)
DataForPasteboardType(String)
DetectPatterns(NSSet<NSString>, Action<NSSet<NSString>,NSError>)
DetectPatterns(NSSet<NSString>, NSIndexSet, Action<NSSet<NSString>[],NSError>)
DetectPatternsAsync(NSSet<NSString>, NSIndexSet)
DetectPatternsAsync(NSSet<NSString>)
DetectValues(NSSet<NSString>, Action<NSDictionary<NSString,NSObject>,NSError>)
DetectValues(NSSet<NSString>, NSIndexSet, Action<NSDictionary<NSString,NSObject>[],NSError>)
DetectValuesAsync(NSSet<NSString>, NSIndexSet)
DetectValuesAsync(NSSet<NSString>)
DidChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String) (Inherited from NSObject)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)

Releases the resources used by the NSObject object.

(Inherited from NSObject)
DoesNotRecognizeSelector(Selector) (Inherited from NSObject)
Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
FromName(String, Boolean)
GetDataForPasteboardType(String, NSIndexSet)
GetDictionaryOfValuesFromKeys(NSString[]) (Inherited from NSObject)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetPasteBoardTypes(NSIndexSet)
GetUnique()
GetValue(String)
GetValuesForPasteboardType(String, NSIndexSet)
Init() (Inherited from NSObject)
InitializeHandle(NativeHandle, String) (Inherited from NSObject)
InitializeHandle(NativeHandle) (Inherited from NSObject)
Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
ItemSetWithPasteboardTypes(String[])
MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MutableCopy() (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double) (Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
Remove(String)
RemoveObserver(NSObject, NSString, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, NSString) (Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, String) (Inherited from NSObject)
RespondsToSelector(Selector) (Inherited from NSObject)
SetData(NSData, String)
SetItemProviders(NSItemProvider[], Boolean, NSDate)
SetItems(NSDictionary<NSString,NSObject>[], NSDictionary)
SetItems(NSDictionary<NSString,NSObject>[], UIPasteboardOptions)

Adds items to the pasteboard.

SetNilValueForKey(NSString) (Inherited from NSObject)
SetObjects(INSItemProviderWriting[], Boolean, NSDate)
SetObjects(INSItemProviderWriting[])
SetValue(NSObject, String)
SetValueForKey(NSObject, NSString) (Inherited from NSObject)
SetValueForKeyPath(NativeHandle, NSString) (Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString) (Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString) (Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary) (Inherited from NSObject)
ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSObject)
ValueForKey(NSString) (Inherited from NSObject)
ValueForKeyPath(NSString) (Inherited from NSObject)
ValueForUndefinedKey(NSString) (Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String) (Inherited from NSObject)

Extension Methods

Name Description
BrowserAccessibilityDeleteTextAtCursor(NSObject, IntPtr)
BrowserAccessibilityInsertTextAtCursor(NSObject, String)
GetAccessibilityLineEndPositionFromCurrentSelection(NSObject)
GetAccessibilityLineRangeForPosition(NSObject, IntPtr)
GetAccessibilityLineStartPositionFromCurrentSelection(NSObject)
GetBrowserAccessibilityAttributedValue(NSObject, NSRange)
GetBrowserAccessibilityContainerType(NSObject)
GetBrowserAccessibilityCurrentStatus(NSObject)
GetBrowserAccessibilityHasDomFocus(NSObject)
GetBrowserAccessibilityIsRequired(NSObject)
GetBrowserAccessibilityPressedState(NSObject)
GetBrowserAccessibilityRoleDescription(NSObject)
GetBrowserAccessibilitySelectedTextRange(NSObject)
GetBrowserAccessibilitySortDirection(NSObject)
GetBrowserAccessibilityValue(NSObject, NSRange)
SetBrowserAccessibilityContainerType(NSObject, BEAccessibilityContainerType)
SetBrowserAccessibilityCurrentStatus(NSObject, String)
SetBrowserAccessibilityHasDomFocus(NSObject, Boolean)
SetBrowserAccessibilityIsRequired(NSObject, Boolean)
SetBrowserAccessibilityPressedState(NSObject, BEAccessibilityPressedState)
SetBrowserAccessibilityRoleDescription(NSObject, String)
SetBrowserAccessibilitySelectedTextRange(NSObject, NSRange)
SetBrowserAccessibilitySortDirection(NSObject, String)
ProvideImageData(NSObject, IntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
ProvideImageToMTLTexture(NSObject, IMTLTexture, IMTLCommandBuffer, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
SetSharedObservers(NSObject, NSKeyValueSharedObserversSnapshot)
GetDebugDescription(INSObjectProtocol)
GetHandle(INativeObject)
GetNonNullHandle(INativeObject, String)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

AccessibilityHitTest(NSObject, CGPoint, UIEvent)
GetAccessibilityNextTextNavigationElement(NSObject)
GetAccessibilityNextTextNavigationElementBlock(NSObject)
GetAccessibilityPreviousTextNavigationElement(NSObject)
GetAccessibilityPreviousTextNavigationElementBlock(NSObject)
SetAccessibilityNextTextNavigationElement(NSObject, NSObject)
SetAccessibilityNextTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
SetAccessibilityPreviousTextNavigationElement(NSObject, NSObject)
SetAccessibilityPreviousTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
GetAccessibilityTextInputResponder(NSObject)
GetAccessibilityTextInputResponderHandler(NSObject)
SetAccessibilityTextInputResponder(NSObject, IUITextInput)
SetAccessibilityTextInputResponderHandler(NSObject, UITextInputReturnHandler)

Applies to

See also