Skip to content

Instantly share code, notes, and snippets.

@abock
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abock/757f21a6a9ffd3f1e075 to your computer and use it in GitHub Desktop.
Save abock/757f21a6a9ffd3f1e075 to your computer and use it in GitHub Desktop.
//
// NSComboBoxExtensions.cs
//
// Author:
// Aaron Bockover <abock@xamarin.com>
//
// Copyright 2015 Xamarin Inc. All rights reserved.
using System;
using System.Runtime.InteropServices;
using ObjCRuntime;
using Foundation;
namespace AppKit
{
public static class NSComboBoxExtensions
{
[DllImport (Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
static extern IntPtr IntPtr_objc_msgSend_nint (IntPtr receiver, IntPtr selector, nint arg1);
static readonly IntPtr selItemObjectValueAtIndex = Selector.GetHandle ("itemObjectValueAtIndex:");
public static NSObject FixedGetItem (this NSComboBox comboBox, nint index)
{
return Runtime.GetNSObject<NSObject> (IntPtr_objc_msgSend_nint (
comboBox.Handle, selItemObjectValueAtIndex, index));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment