Esempio n. 1
0
        void UpdateTabBarItem(UITabBarItem item)
        {
            if (item == null)
            {
                return;
            }

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("CircularSpotifyTxT-Bold", 13), TextColor = Color.FromHex("#686868").ToUIColor()
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("CircularSpotifyTxT-Bold", 13), TextColor = Color.White.ToUIColor()
            }, UIControlState.Selected);

            // Moves the titles up just a bit.
            if (UIInterfaceOrientation.LandscapeLeft == UIApplication.SharedApplication.StatusBarOrientation ||
                UIInterfaceOrientation.LandscapeRight == UIApplication.SharedApplication.StatusBarOrientation)
            {
                item.TitlePositionAdjustment = new UIOffset(0f, -7f);
            }
            else
            {
                item.TitlePositionAdjustment = new UIOffset(0f, -13f);
            }
        }
Esempio n. 2
0
        void UpdateItem(UITabBarItem item, string icon, string selectIcon)
        {
            if (item == null)
            {
                return;
            }

            // set default icon
            if (item?.Image?.AccessibilityIdentifier == icon)
            {
                return;
            }
            item.Image = UIImage.FromBundle(icon);
            item.Image.AccessibilityIdentifier = icon;
            //set select icon
            if (item?.SelectedImage?.AccessibilityIdentifier == selectIcon)
            {
                return;
            }
            item.SelectedImage = UIImage.FromBundle(selectIcon);
            item.SelectedImage.AccessibilityIdentifier = selectIcon;
            //set font
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.SystemFontOfSize(10, UIFontWeight.Light)
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.SystemFontOfSize(10, UIFontWeight.Light)
            }, UIControlState.Selected);
        }
Esempio n. 3
0
 private void UpdateTabBarItem(UITabBarItem item, string icon)
 {
     if (item == null)
     {
         return;
     }
     if (icon != null)
     {
         var image = UIImage.FromFile(icon);
         var imgR  = ResizeImage(image, 30, 30);
         item.Image         = imgR;
         item.SelectedImage = imgR;
         item.ImageInsets   = new UIEdgeInsets(15f, 0, -15f, 0);
     }
     if (item.Title == "菜单" || item.Title == "搜索")
     {
         item.Title = string.Empty;
     }
     item.SetTitleTextAttributes(new UITextAttributes()
     {
         Font = UIFont.SystemFontOfSize(12), TextColor = Xamarin.Forms.Color.FromHex("#757575").ToUIColor()
     }, UIControlState.Normal);
     item.SetTitleTextAttributes(new UITextAttributes()
     {
         Font = UIFont.SystemFontOfSize(16), TextColor = Xamarin.Forms.Color.FromHex("#333333").ToUIColor()
     }, UIControlState.Selected);
     item.TitlePositionAdjustment = new UIOffset(0, -4);
 }
Esempio n. 4
0
        private void UpdateTabBarItem(UITabBarItem item, string icon)
        {
            if (item == null || icon == null)
            {
                return;
            }

            // Set our different selected icons
            icon = icon.Replace(".png", "_selected.png");

            if (item?.SelectedImage?.AccessibilityIdentifier == icon)
            {
                return;
            }

            item.SelectedImage = UIImage.FromBundle(icon);
            item.SelectedImage.AccessibilityIdentifier = icon;

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("MuseoSans-500", 10), TextColor = Color.FromHex("#757575").ToUIColor()
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("MuseoSans-500", 10), TextColor = Color.FromHex("#2dc9d7").ToUIColor()
            }, UIControlState.Selected);

            // Moves the titles up just a bit.
            item.TitlePositionAdjustment = new UIOffset(0, -2);
        }
        private void UpdateItem(UITabBarItem item, string icon)
        {
            if (item == null)
            {
                return;
            }
            try
            {
                icon = icon.Replace("nofill.png", "filled.png");
                if (item?.SelectedImage?.AccessibilityIdentifier == icon)
                {
                    return;
                }
                item.SelectedImage = UIImage.FromBundle(icon);
                item.SelectedImage.AccessibilityIdentifier = icon;

                item.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.Green
                }, UIControlState.Selected);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unable to set selected icon: " + ex);
            }
        }
Esempio n. 6
0
 public static void SetTitleColor(this UITabBarItem tabBarItem, UIColor color, UIControlState state)
 {
     tabBarItem.SetTitleTextAttributes(new UITextAttributes()
     {
         TextColor = color
     }, state);
 }
        private void UpdateItem(UITabBarItem item, UIColor selected, UIColor unselected)
        {
            if (item == null)
            {
                return;
            }

            item.SetTitleTextAttributes(new UITextAttributes
            {
                TextColor = selected
            }, UIControlState.Selected);

            item.SetTitleTextAttributes(new UITextAttributes
            {
                TextColor = unselected
            }, UIControlState.Normal);
        }
        private void UpdateTabBarItem(UITabBarItem item, string icon)
        {
            if (item == null || icon == null)
            {
                return;
            }

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("GillSans-UltraBold", 12), TextColor = Color.FromHex("#757575").ToUIColor()
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("GillSans-UltraBold", 12), TextColor = Color.FromHex("#3C9BDF").ToUIColor()
            }, UIControlState.Selected);
        }
Esempio n. 9
0
 public override void ItemSelected(UITabBar tabbar, UITabBarItem item)
 {
     ResizeIcons();
     item.SetTitleTextAttributes(new UITextAttributes()
     {
         Font = UIFont.PreferredCaption1
     }, UIControlState.Normal);
 }
Esempio n. 10
0
        //void AddFonts()
        //{
        //    UITabBarItem.Appearance.SetTitleTextAttributes(new UITextAttributes
        //    {
        //        TextColor = Color.FromHex("#757575").ToUIColor(),
        //        Font = UIFont.FromName("GillSans-UltraBold", 12)
        //    }, UIControlState.Normal);

        //    UITabBarItem.Appearance.SetTitleTextAttributes(new UITextAttributes
        //    {
        //        TextColor = Color.FromHex("#3C9BDF").ToUIColor(),
        //        Font = UIFont.FromName("GillSans-UltraBold", 12)
        //    }, UIControlState.Selected);

        //}

        private void UpdateTabBarItem(UITabBarItem item, string icon)
        {
            if (item == null || icon == null)
            {
                return;
            }

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = Color.FromHex("#757575").ToUIColor(), Font = UIFont.SystemFontOfSize(12)
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = Color.FromHex("#4267B2").ToUIColor(), Font = UIFont.SystemFontOfSize(12)
            }, UIControlState.Selected);
        }
Esempio n. 11
0
        void SetTitleAttributes(UITabBarItem item)
        {
            if (item == null)
            {
                return;
            }

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName((string)Xamarin.Forms.Application.Current.Resources["font_regular"], 13)
            }, UIControlState.Normal);

            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName((string)Xamarin.Forms.Application.Current.Resources["font_regular"], 13)
            }, UIControlState.Selected);
        }
        private void UpdateTabBarItem(UITabBarItem item, string icon)
        {
            if (item == null || icon == null)
            {
                return;
            }

            // item.ImageInsets = new UIEdgeInsets(5, 0, 0, 0);
            item.TitlePositionAdjustment = new UIOffset(0, 5);
            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName(fontFamily, 12), TextColor = Color.FromHex("#757575").ToUIColor()
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName(fontFamily, 12), TextColor = Color.FromHex("#3C9BDF").ToUIColor()
            }, UIControlState.Selected);
        }
Esempio n. 13
0
        private void UpdateTabBarItem(UITabBarItem item)
        {
            if (item == null)
            {
                return;
            }

            var TabsFont = new UITextAttributes()
            {
                Font = UIFont.SystemFontOfSize(15)
            };

            // Set the font for the title.
            item.SetTitleTextAttributes(TabsFont, UIControlState.Normal);
            item.SetTitleTextAttributes(TabsFont, UIControlState.Selected);

            // Moves the titles up just a bit.
            item.TitlePositionAdjustment = new UIOffset(0, -((int)UIApplication.SharedApplication.StatusBarFrame.Height / 2));
        }
Esempio n. 14
0
        private void UpdateTabBarItem(UITabBarItem item, string icon)
        {
            if (item == null || icon == null)
            {
                return;
            }

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = Color.Gray.ToUIColor()
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = Color.Black.ToUIColor()
            }, UIControlState.Selected);

            // Moves the titles up just a bit.
            item.TitlePositionAdjustment = new UIOffset(0, -2);
        }
        void UpdateTabBarItem(UITabBarItem item, string icon)
        {
            if (item == null || icon == null)
            {
                return;
            }

            // Set the font for the title.
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("CircularSpotifyTxT-Book", 11), TextColor = Color.FromHex("#adaeb2").ToUIColor()
            }, UIControlState.Normal);
            item.SetTitleTextAttributes(new UITextAttributes()
            {
                Font = UIFont.FromName("CircularSpotifyTxT-Book", 11), TextColor = Color.FromHex("#ffffff").ToUIColor()
            }, UIControlState.Selected);

            // Moves the titles up just a bit.
            item.TitlePositionAdjustment = new UIOffset(0, -2);
        }