예제 #1
0
        static string [] GenerateCurrentIDList(TouchBarExampleDelegate current)
        {
            int count = current.Count;

            string [] ids = new string [count];
            for (int i = 0; i < count; ++i)
            {
                ids [i] = TouchBarExampleDelegate.CreateID(i);
            }
            return(ids);
        }
예제 #2
0
        public NSTouchBar MakeTouchBar()
        {
            int index = (int)Tab.IndexOf(Tab.Selected);
            TouchBarExampleDelegate current = examples [index];

            var bar = new NSTouchBar()
            {
                Delegate = current,
            };

            if (current.AllowCustomization)
            {
                var idList = GenerateCurrentIDList(current);
                bar.CustomizationIdentifier             = "com.xamarin.example.customBar";
                bar.DefaultItemIdentifiers              = idList.Take(2).ToArray();
                bar.CustomizationAllowedItemIdentifiers = idList;
            }
            else
            {
                bar.DefaultItemIdentifiers = GenerateCurrentIDList(current);
            }

            return(bar);
        }