From 551e82d33c9c23442e0ecd320bcfc752f300d9ef Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 22 三月 2021 09:20:03 +0800 Subject: [PATCH] Merge branch 'temp-wxr' into WJC --- HDL-ON_iOS/Other/JLCountrycode.cs | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/HDL-ON_iOS/Other/JLCountrycode.cs b/HDL-ON_iOS/Other/JLCountrycode.cs index f6a2451..176a7df 100644 --- a/HDL-ON_iOS/Other/JLCountrycode.cs +++ b/HDL-ON_iOS/Other/JLCountrycode.cs @@ -1,5 +1,7 @@ 锘縰sing System; using Shared.IOS.JLCountryCode; +using Foundation; +using System.Collections.Generic; namespace JLCountrycode { @@ -40,5 +42,60 @@ Shared.Application.currentVC.NavigationController.PushViewController(mJLCountryCodeController, true); } + + + /// <summary> + /// 閫夋嫨 + /// </summary> + /// <param name="titleStr"></param> + /// <param name="dic"></param> + /// <param name="action"></param> + public void ShowSortSelection(string titleStr, Dictionary<string, List<string>> dic, Action<string> action) + { + try + { + JLSortSelectionViewController vc = new JLSortSelectionViewController(); + vc.TitleStr = titleStr; + vc.SortedNameDict = ConvertToNativeDictionary(dic); + vc.SortSelectionBlock += (countryName) => + { + action?.Invoke(countryName); + }; + + Shared.Application.currentVC.NavigationController.PushViewController(vc, true); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + + } + + /// <summary> + /// Dictionary 杞� iOS鍘熺敓 NSMutableDictionary + /// </summary> + /// <param name="dict"></param> + /// <returns></returns> + NSMutableDictionary ConvertToNativeDictionary(Dictionary<string, List<string>> dict) + { + NSMutableDictionary newDictionary = new NSMutableDictionary(); + try + { + //var dictDataList = new NSMutableArray(); + foreach (string key in dict.Keys) + { + var value = dict[key]; + newDictionary.Add(new NSString(key), NSArray.FromObjects(value.ToArray())); + } + } + catch (Exception Ex) + { + Console.WriteLine(Ex.ToString()); + } + return newDictionary; + } + + + } } \ No newline at end of file -- Gitblit v1.8.0