Ejemplo n.º 1
0
        void DisplaySyncResult(string result)
        {
            SyncResultLabel.Text = result;

            SyncResultLabel.SizeToFit( );

            View.SetNeedsLayout( );
        }
Ejemplo n.º 2
0
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();


            // because there's no placeholder, we can't SizeToFit the URL Field, so we'll measure the font and then size it.
            RockUrlField.Bounds = new CGRect(0, 0, View.Bounds.Width * .75f, 0);
            CGSize size = RockUrlField.SizeThatFits(new CGSize(RockUrlField.Bounds.Width, RockUrlField.Bounds.Height));

            RockUrlField.Bounds = new CGRect(RockUrlField.Bounds.X, RockUrlField.Bounds.Y, RockUrlField.Bounds.Width, (float)System.Math.Ceiling(size.Height));


            // center the rock URL field and title
            RockUrlTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, View.Bounds.Height * .05f);
            RockUrlField.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2,
                                                      RockUrlTitle.Frame.Bottom + 10);



            // because there's no placeholder, we can't SizeToFit the URL Field, so we'll measure the font and then size it.
            RockAuthKeyField.Bounds = new CGRect(0, 0, View.Bounds.Width * .75f, 0);
            size = RockAuthKeyField.SizeThatFits(new CGSize(RockAuthKeyField.Bounds.Width, RockAuthKeyField.Bounds.Height));
            RockAuthKeyField.Bounds = new CGRect(RockAuthKeyField.Bounds.X, RockAuthKeyField.Bounds.Y, RockAuthKeyField.Bounds.Width, (float)System.Math.Ceiling(size.Height));


            // center the rock URL field and title
            RockAuthKeyTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockAuthKeyField.Bounds.Width) / 2, RockUrlField.Frame.Bottom + 10);
            RockAuthKeyField.Layer.Position = new CGPoint((View.Bounds.Width - RockAuthKeyField.Bounds.Width) / 2, RockAuthKeyTitle.Frame.Bottom + 10);


            // set the submit bounds and position
            Sync.Bounds         = new CGRect(0, 0, RockAuthKeyField.Bounds.Width * .15f, Sync.Bounds.Height);
            Sync.Layer.Position = new CGPoint(RockAuthKeyField.Frame.Right - Sync.Bounds.Width, RockAuthKeyField.Frame.Bottom + 10);

            // let the label stretch the entire width
            SyncResultLabel.Bounds = new CGRect(0, 0, View.Bounds.Width, 0);
            SyncResultLabel.SizeToFit( );
            SyncResultLabel.Frame = new CGRect(0, Sync.Frame.Bottom + 20, View.Bounds.Width, SyncResultLabel.Bounds.Height);


            // set the campus table and center its label above it
            CampusesLabel.Layer.Position = new CGPoint(RockUrlTitle.Layer.Position.X, Sync.Frame.Bottom + 60);

            // table
            CampusTableView.Layer.Position = new CGPoint(RockUrlTitle.Layer.Position.X, CampusesLabel.Frame.Bottom);
            CampusTableView.Bounds         = new CGRect(0, 0, 200, 300);


            nfloat switchWidth = CampusSwitchLabel.Bounds.Width + CampusSwitch.Bounds.Width + 10;
            nfloat switchXPos  = (CampusTableView.Bounds.Width - switchWidth) / 2;

            CampusSwitchLabel.Layer.Position = new CGPoint(RockUrlTitle.Layer.Position.X + switchXPos, View.Bounds.Height * .85f);
            CampusSwitch.Layer.Position      = new CGPoint(CampusSwitchLabel.Frame.Right + 10, View.Bounds.Height * .85f);


            // set the template table and center ITS label as well
            TemplateLabel.Layer.Position = new CGPoint(View.Bounds.Width - 300, Sync.Frame.Bottom + 60);

            TemplateTableView.Layer.Position = new CGPoint(View.Bounds.Width - 300, TemplateLabel.Frame.Bottom);
            TemplateTableView.Bounds         = new CGRect(0, 0, 200, 300);


            // set the blocker
            BlockerView.SetBounds(View.Bounds.ToRectF( ));


            // set the Cancel / Save button toward the bottom
            Cancel.Bounds = new CGRect(0, 0, 100, Cancel.Bounds.Height);
            Save.Bounds   = new CGRect(0, 0, 100, Save.Bounds.Height);

            //nfloat buttonWidth = Cancel.Bounds.Width + Save.Bounds.Width + 10;

            Save.Layer.Position   = new CGPoint(View.Bounds.Width - 300, View.Bounds.Height * .85f);
            Cancel.Layer.Position = new CGPoint(Save.Frame.Right + 10, View.Bounds.Height * .85f);
        }