MonoTouch 獲取UIBarButtonItem的位置

這只是一個事例。this

在這個例子中,先在NavigationController 中找UIView,而後在找到的位置,用一個UIView覆蓋它。spa

        UIView view = null;
            foreach (UIView subview in this.NavigationController.NavigationBar) {
                if (subview is UIControl) {
                    Console.WriteLine (subview.ToString ());
                    Console.WriteLine (subview.Frame);
                    view = new UIView (subview.Frame)
                    {
                        BackgroundColor = UIColor.Black
                    };
                    break;
                }
            }

            if (view!=null)
            this.NavigationController.NavigationBar.Add (view);
相關文章
相關標籤/搜索