Created
September 25, 2012 12:56
-
-
Save rolfbjarne/3781627 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UIImage[] GetImagesIOS6 (UIPasteboard pasteboard) | |
{ | |
global::MonoTouch.UIKit.UIApplication.EnsureUIThread (); | |
if (pasteboard == null) | |
throw new ArgumentNullException ("pasteboard"); | |
var arrayptr = global::MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend (pasteboard.Handle, new global::MonoTouch.ObjCRuntime.Selector ("images").Handle); | |
if (arrayptr == IntPtr.Zero) | |
return null; | |
var array = new NSArray (arrayptr); | |
var ret = new UIImage [array.Count]; | |
for (uint i = 0; i < ret.Length; i++) { | |
var obj = global::MonoTouch.ObjCRuntime.Runtime.GetNSObject (array.ValueAt (i)); | |
var data = obj as NSData; | |
UIImage img; | |
if (data != null) { | |
img = new UIImage (data); | |
} else { | |
img = (UIImage) obj; | |
} | |
ret [i] = img; | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment