2017-09-15 118 views
2

Xamarin(特别是Xamarin.IOS)有任何NuGet套件或国家选择器组件吗?Xamarin的国家选择器

我发现了一些Native IOS库。

CountryPicker

MRCountryPicker

我想在Xamarin

一个类似上面的东西

感谢

+0

您可以创建一个绑定库来创建一个本地的iOS库中的C#包装 - 看到https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/ – Jason

+0

@Jason感谢您的回复。这对我来说很紧迫,我也没有创建C#包装的经验,您能为我创建它吗? –

+0

@ Passionate.C对我有帮助吗? –

回答

1

Here是我的样本。

enter image description here

CountryPickerBind是BindingProject

PickerSample是一个使用dll的简单演示,您可以运行它并查看效果。

步骤在您的项目中使用CountryPicker。

  1. 构建CountryPickerBind

  2. DLL的引用添加到您的项目。(DLL座落于斌/调试/在CountryPickerBind *。DLL)

enter image description here

  1. 在故事板或xib中添加PickerView,并使类CountryPicker

enter image description here

  • 按照ViewController中的代码来分配委托。

  • 添加图像(Resources/CountryPicker.bundle/*。png);

  • 跑吧!

  • enter image description here

    +0

    我已经试过这个,似乎工作。但它不会在我的项目中显示标志图标。我在你的测试项目中看到了这些标志。我该如何解决它? –

    +0

    @ Passionate.C可能你错过了第5步 –

    +0

    不,我把所有的png都添加到我的资源文件夹中。 将您的测试项目中的Resources/CountryPicker.bundle/*。png的所有png文件复制到我的项目中的Resources/*。png中 –