예제 #1
0
        public static void SetFlatNavigationBarAppearance(UINavigationBar.UINavigationBarAppearance appearance, UIColor color, UIColor textColor)
        {
            UIImage backgroundImage = FlatUI.Image(color, 0);
            appearance.SetBackgroundImage(backgroundImage, UIBarMetrics.Default);
            appearance.SetBackgroundImage(backgroundImage, UIBarMetrics.LandscapePhone);

            UITextAttributes titleTextAttributes = appearance.GetTitleTextAttributes();
            if (titleTextAttributes == null)
                titleTextAttributes = new UITextAttributes();
            titleTextAttributes.TextShadowColor = UIColor.Clear;
            titleTextAttributes.TextShadowOffset = new UIOffset(0, 0);
            titleTextAttributes.TextColor = textColor;
            titleTextAttributes.Font = FlatUI.BoldFontOfSize(0);
            appearance.SetTitleTextAttributes(titleTextAttributes);
            if (appearance.RespondsToSelector(new MonoTouch.ObjCRuntime.Selector("setShadowImage:")))
                appearance.ShadowImage = FlatUI.Image(UIColor.Clear, 0);
        }