MonoTouch 获取UIBarButtonItem的位置

这只是一个事例。

在这个例子中,先在NavigationController 中找UIView,然后在找到的位置,用一个UIView覆盖它。

        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);
posted @ 2013-12-05 11:32  朱静程  阅读(469)  评论(0编辑  收藏  举报