Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var shift1Button = new UIBarButtonItem ();
            shift1Button.Title = "Shift 1";
            shift1Button.Style = UIBarButtonItemStyle.Bordered;
            var shift2Button = new UIBarButtonItem ();
            shift2Button.Title = "Shift 2";
            shift2Button.Style = UIBarButtonItemStyle.Bordered;
            SetToolbarItems (new UIBarButtonItem[] {
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
                shift1Button,
                shift2Button,
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace)
            },false);
            NavigationController.ToolbarHidden = false;
            var labels = new [] { "Omega 3", "Herb", "RJ", "JD","RWA","NP", "NPO" };
            var segments = new SDSegmentedControl (labels) {
                Frame = new RectangleF (0, 0, 320, 44)
            };
            segments.ValueChanged += (sender, e) => {
                Console.WriteLine ("Selected " + segments.SelectedSegment);
                View.Add(new ProductionSegmentsTableView(new RectangleF (0, 44, View.Bounds.Width, View.Bounds.Height)));
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            };

            View.AddSubview (segments);
            View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
        }
        public override void LoadView()
        {
            base.LoadView ();

            bool isV7 = UIDevice.CurrentDevice.CheckSystemVersion (7, 0);

            View.BackgroundColor = UIColor.White;

            niceSegmentedCtrl = new SDSegmentedControl (new string [] { "Google", "Bing", "Yahoo" });

            if (isV7)
                niceSegmentedCtrl.Frame = new RectangleF (0, 10, 320, 44);
            else
                niceSegmentedCtrl.Frame = new RectangleF (0, 0, 320, 44);

            niceSegmentedCtrl.SetImage (UIImage.FromBundle ("google"), 0);
            niceSegmentedCtrl.SetImage (UIImage.FromBundle ("bicon"), 1);
            niceSegmentedCtrl.SetImage (UIImage.FromBundle ("yahoo"), 2);
            niceSegmentedCtrl.ValueChanged += HandleValueChanged;

            if (isV7)
                browser = new UIWebView (new RectangleF (0, 55, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 64));
            else
                browser = new UIWebView (new RectangleF (0, 45, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 64));

            browser.LoadRequest (new NSUrlRequest ( new NSUrl ("http://google.com")));
            browser.AutosizesSubviews = true;

            View.AddSubviews ( new UIView[] { niceSegmentedCtrl, browser });
        }