Hi,

On Thu, Feb 7, 2013 at 12:15 PM, Nic Wise <n...@fastchicken.co.nz> wrote:

> You could look at how it works, and do the same - its just sending a
> message.
>
> eg:
>
> public static class UIImageExtensions
>     {
>
>
>         /// <summary>
>         /// Description A succinct label that identifies the
> accessibility element, in a localized string.
>         /// </summary>
>         public static UIImage CreateResizableImage_WithMode (this
> UIImage image, UIEdgeInsets capInsets, UIImageResizingMode
> resizingMode);
>         {
>
> then, looking at how the one works without the resizing mode:
>
> UIImage result;
>     using (new NSAutoreleasePool ())
>     {
>         if (this.IsDirectBinding)
>         {
>             result = (UIImage)Runtime.GetNSObject
> (Messaging.IntPtr_objc_msgSend_UIEdgeInsets (base.Handle,
> UIImage.selResizableImageWithCapInsets_, capInsets));
>         }
>         else
>         {
>             result = (UIImage)Runtime.GetNSObject
> (Messaging.IntPtr_objc_msgSendSuper_UIEdgeInsets (base.SuperHandle,
> UIImage.selResizableImageWithCapInsets_, capInsets));
>         }
>     }
>     return result;
>
> So, your method might look like this:
>
> public static UIImage Foo(this UIImage image, UIEdgeInsets capInsets,
> UIImageResizingMode resizingMode)
>         {
>             UIImage result;
>             using (new NSAutoreleasePool ())
>             {
>                 if (image.IsDirectBinding)
>                 {
>                     result = (UIImage)Runtime.GetNSObject
> (Messaging.IntPtr_objc_msgSend_UIEdgeInsets_int (image.Handle, new
> Selector("resizableImageWithCapInsets:resizingMode:"), capInsets,
>
>                                     resizingMode));
>                 }
>                 else
>                 {
>                     result = (UIImage)Runtime.GetNSObject
> (Messaging.IntPtr_objc_msgSend_UIEdgeInsets_int (image.SuperHandle,
> new Selector("resizableImageWithCapInsets:resizingMode:"), capInsets,
>
>                                     resizingMode));
>                 }
>             }
>             return result;
>         }
>
> PROBLEMS: IsDirectBinding: I'm not sure how you get that. It's
> protected, so you MIGHT need to make
>

You can use image.GetType () == typeof (UIImage) instead of IsDirectBinding
(or probably just default to true, since it's very uncommon to derive from
UIImage in the first place, unless you follow the next suggestion from Nic
:).


>
>  public class MDImage : UIImage


> and put the method in there. I think it has something to do with the
> simulator vrs not.... Someone like Rolf or Sebastien might be able to
> help on that tho - if they dont pop up here, ask on the forums.
>
> On 7 February 2013 10:46,  <markdan...@avolites.com> wrote:
> >
> > On 7 Feb 2013, at 10:35, Nic Wise wrote:
> >
> >> Thanks - I guess the guys from Xamarin will get to it. These kind of
> >> binding issues popup from time to time - usually fixed fairly quickly.
> >
> > I am curious is there any way you can add a binding just for one method?
> > Something like the PInvoke syntax?
> >
> > Mark Daniel.
> >
> >
> >
> > _______________________________________________
> > MonoTouch mailing list
> > MonoTouch@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/monotouch
>
>
>
> --
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken
> b. http://www.fastchicken.co.nz/
> _______________________________________________
> MonoTouch mailing list
> MonoTouch@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to