2017-09-15 119 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中 –