public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); // set the search field and refresh button, cause those are known SearchField.Layer.Position = new CGPoint(10, 25); SearchField.ViewDidLayoutSubviews(new CGRect(0, 0, View.Bounds.Width * 0.3375f, View.Bounds.Height)); // position the clear button ClearButton.SizeToFit( ); ClearButton.Bounds = new CGRect(0, 0, ClearButton.Bounds.Width * 2, SearchButton.Bounds.Height); ClearButton.Layer.Position = new CGPoint(SearchField.Frame.Right - ClearButton.Bounds.Width, SearchField.Frame.Bottom + 10); // now set the search button, which will use remaining width SearchButton.Layer.Position = new CGPoint(10, SearchField.Frame.Bottom + 10); SearchButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, 0); SearchButton.SizeToFit( ); SearchButton.Frame = new CGRect(10, SearchField.Frame.Bottom + 10, SearchField.Bounds.Width - ClearButton.Bounds.Width - 2, SearchButton.Bounds.Height); // position the 'add family' button AddFamilyButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, SearchButton.Bounds.Height); AddFamilyButton.Layer.Position = new CGPoint(SearchButton.Frame.Left, SearchButton.Frame.Bottom + 10); // setup the table view nfloat tableXPos = SearchField.Frame.Right + 10; TableView.Frame = new CGRect(tableXPos, SearchField.Layer.Position.Y, View.Bounds.Width - tableXPos, View.Bounds.Height); TableView.SetNeedsLayout( ); BlockerView.SetBounds(View.Bounds.ToRectF( )); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); BlockerView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); }
public override void LayoutChanged() { base.LayoutChanged(); ResultView.SetBounds(View.Bounds.ToRectF( )); BlockerView.SetBounds(View.Bounds.ToRectF( )); }
public override void LayoutChanged( ) { base.LayoutChanged( ); ScrollView.Bounds = View.Bounds; SearchPage.LayoutChanged(ScrollView.Frame.ToRectF( )); // Map MapView.Frame = new CGRect(0, 0, ScrollView.Frame.Width, ScrollView.Frame.Height * .40f); SearchAddressButton.Frame = new CGRect(0, MapView.Frame.Bottom, ScrollView.Frame.Width, 33); // Search Results Banner UpdateResultsBanner( ); // add the seperator to the bottom Seperator.Frame = new CGRect(0, SearchResultsPrefix.Frame.Bottom - 1, ScrollView.Bounds.Width, 1); // wait to layout the table view until all subviews have been laid out. Fixes an issue where the table gets more height than it should, // and the last row doesn't fit on screen. GroupFinderTableView.Frame = new CGRect(0, Seperator.Frame.Bottom, ScrollView.Bounds.Width, ScrollView.Bounds.Height - Seperator.Frame.Bottom); GroupFinderTableView.ReloadData( ); BlockerView.SetBounds(ScrollView.Frame.ToRectF( )); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); BlockerView.SetBounds(View.Bounds.ToRectF( )); ResultView.SetBounds(View.Bounds.ToRectF( )); HeaderView.Frame = new CGRect(View.Frame.Left, View.Frame.Top, View.Frame.Width, StyledTextField.StyledFieldHeight); ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height); NickName.SetFrame(new CGRect(-10, View.Frame.Height * .05f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); LastName.SetFrame(new CGRect(-10, NickName.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Email.SetFrame(new CGRect(-10, LastName.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); CellPhone.SetFrame(new CGRect(-10, Email.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Street.SetFrame(new CGRect(-10, CellPhone.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); City.SetFrame(new CGRect(-10, Street.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); State.SetFrame(new CGRect(-10, City.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Zip.SetFrame(new CGRect(-10, State.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Gender.SetFrame(new CGRect(-10, Zip.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); GenderButton.Frame = Gender.Background.Frame; Birthdate.SetFrame(new CGRect(-10, Gender.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); BirthdayButton.Frame = Birthdate.Background.Frame; HomeCampus.SetFrame(new CGRect(-10, Birthdate.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); HomeCampusButton.Frame = HomeCampus.Background.Frame; DoneButton.Frame = new CGRect(View.Frame.Left + 10, HomeCampus.Background.Frame.Bottom + 20, View.Bounds.Width - 20, ControlStyling.ButtonHeight); LogoutButton.Frame = new CGRect((View.Frame.Width - ControlStyling.ButtonWidth) / 2, DoneButton.Frame.Bottom + 20, ControlStyling.ButtonWidth, ControlStyling.ButtonHeight); nfloat controlBottom = LogoutButton.Frame.Bottom + (View.Bounds.Height * .25f); ScrollView.ContentSize = new CGSize(0, (nfloat)Math.Max(controlBottom, View.Bounds.Height * 1.05f)); // setup the header shadow UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds); HeaderView.Layer.MasksToBounds = false; HeaderView.Layer.ShadowColor = UIColor.Black.CGColor; HeaderView.Layer.ShadowOffset = new CGSize(0.0f, .0f); HeaderView.Layer.ShadowOpacity = .23f; HeaderView.Layer.ShadowPath = shadowPath.CGPath; if (LogoView != null) { LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0); } BirthdatePicker.LayoutChanged( ); GenderPicker.LayoutChanged( ); GenderPicker.TogglePicker(false, false); BirthdatePicker.TogglePicker(false, false); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); Logo.Layer.Position = new CGPoint((View.Bounds.Width - Logo.Bounds.Width) / 2, 25); // Title RockUrlTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, View.Bounds.Height * .25f); // 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 RockUrlField.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, RockUrlTitle.Frame.Bottom + 5); // Title RockAuthKeyTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, RockUrlField.Frame.Bottom + 20); // 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)); RockAuthKeyField.Layer.Position = new CGPoint((View.Bounds.Width - RockAuthKeyField.Bounds.Width) / 2, RockAuthKeyTitle.Frame.Bottom + 5); // Description RockUrlDesc.Layer.Position = new CGPoint(RockUrlField.Frame.Left, RockAuthKeyField.Frame.Bottom + 5); // set the blocker BlockerView.SetBounds(View.Bounds.ToRectF( )); // set the submit bounds and position Submit.SizeToFit( ); Submit.Bounds = new CGRect(0, 0, RockUrlField.Bounds.Width * .35f, Submit.Bounds.Height * 1.25f); Submit.Layer.Position = new CGPoint(RockUrlField.Frame.Left + ((RockUrlField.Bounds.Width - Submit.Bounds.Width) / 2), RockUrlDesc.Frame.Bottom + 60); // let the label stretch the entire width ResultLabel.Bounds = new CGRect(0, 0, View.Bounds.Width, 0); ResultLabel.SizeToFit( ); ResultLabel.Frame = new CGRect(0, Submit.Frame.Bottom + 30, View.Bounds.Width, ResultLabel.Bounds.Height); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize(displaySize); if (MapView != null) { MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f); } BlockerView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); HeaderView.Frame = new CGRect(View.Frame.Left, View.Frame.Top, View.Frame.Width, StyledTextField.StyledFieldHeight); ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height); UserNameText.SetFrame(new CGRect(-10, View.Frame.Height * .05f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); PasswordText.SetFrame(new CGRect(-10, UserNameText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); ConfirmPasswordText.SetFrame(new CGRect(-10, PasswordText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); NickNameText.SetFrame(new CGRect(-10, ConfirmPasswordText.Background.Frame.Bottom + 40, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); LastNameText.SetFrame(new CGRect(-10, NickNameText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); EmailText.SetFrame(new CGRect(-10, LastNameText.Background.Frame.Bottom + 40, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); CellPhoneText.SetFrame(new CGRect(-10, EmailText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); DoneButton.Frame = new CGRect(View.Frame.Left + 10, CellPhoneText.Background.Frame.Bottom + 20, View.Bounds.Width - 20, ControlStyling.ButtonHeight); CancelButton.Frame = new CGRect((View.Frame.Width - ControlStyling.ButtonWidth) / 2, DoneButton.Frame.Bottom + 20, ControlStyling.ButtonWidth, ControlStyling.ButtonHeight); // for the scroll size, if the content is larger than the screen, we'll take the bottom // of the content plus some padding. Otherwise, we'll just use the window height plus a tiny bit so there's // a subtle scroll effect nfloat controlBottom = CancelButton.Frame.Bottom + (View.Bounds.Height * .25f); ScrollView.ContentSize = new CGSize(0, (nfloat)Math.Max(controlBottom, View.Bounds.Height * 1.05f)); // setup the header shadow UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds); HeaderView.Layer.MasksToBounds = false; HeaderView.Layer.ShadowColor = UIColor.Black.CGColor; HeaderView.Layer.ShadowOffset = new CGSize(0.0f, .0f); HeaderView.Layer.ShadowOpacity = .23f; HeaderView.Layer.ShadowPath = shadowPath.CGPath; if (LogoView != null) { LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0); } ResultView.SetBounds(View.Frame.ToRectF( )); BlockerView.SetBounds(View.Frame.ToRectF( )); }
public override void LayoutChanged( ) { base.LayoutChanged( ); // get the orientation state. WE consider unknown- 1, profile 0, landscape 1, int orientationState = SpringboardViewController.IsDeviceLandscape( ) == true ? 1 : 0; // if the states are in disagreement, correct it if (OrientationState != orientationState) { OrientationState = orientationState; BibleWebView.Frame = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height); BibleWebView.Layer.Position = new CGPoint(BibleWebView.Layer.Position.X, BibleWebView.Layer.Position.Y); BlockerView.SetBounds(View.Bounds.ToRectF( )); ResultView.SetBounds(View.Bounds.ToRectF( )); } }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews( ); BlockerView.SetBounds(MainPanel.Bounds.ToRectF( )); BackgroundPanel.Bounds = View.Bounds; BackgroundPanel.Layer.Position = View.Layer.Position; // setup the scroll view and contents ScrollView.Bounds = MainPanel.Bounds; // layout the active view SearchPanel.ViewDidLayoutSubviews(MainPanel.Bounds); PeoplePanel.ViewDidLayoutSubviews(MainPanel.Bounds); CloseButton.Layer.Position = new CGPoint(MainPanel.Bounds.Width - CloseButton.Bounds.Width - 10, 5); nfloat scrollSize = Math.Max((float)ActivePanel.GetRootView( ).Frame.Bottom, (float)MainPanel.Bounds.Height) * 1.05f; ScrollView.ContentSize = new CGSize(MainPanel.Bounds.Width, scrollSize); }
public override void LayoutChanged() { base.LayoutChanged(); float viewRealHeight = (float)(View.Bounds.Height - Task.NavToolbar.Frame.Height); float cardSizePerc = .83f; float cardWidth = (float)(View.Bounds.Width * cardSizePerc); float cardHeight = (float)(viewRealHeight * cardSizePerc); float cardYOffset = (viewRealHeight * .03f); // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right Carousel.LayoutChanged(cardWidth, cardHeight, new System.Drawing.RectangleF(0, cardYOffset, (float)View.Bounds.Width, viewRealHeight)); CardSize = new CGRect(0, 0, cardWidth, cardHeight); for (int i = 0; i < PrayerRequests.Count; i++) { PrayerRequests[i].LayoutChanged(CardSize.ToRectF( )); } BlockerView.SetBounds(View.Bounds.ToRectF( )); ResultView.SetBounds(View.Bounds.ToRectF( )); }
public void LayoutChanged(RectangleF containerBounds) { View.Frame = new RectangleF(containerBounds.Left, containerBounds.Top, containerBounds.Width, containerBounds.Height); BlockerView.SetBounds(containerBounds); ResultView.SetBounds(containerBounds); if (IsDownloading == false) { float sectionSpacing = Rock.Mobile.Graphics.Util.UnitToPx(25); float textLeftInset = Rock.Mobile.Graphics.Util.UnitToPx(10); float textTopInset = Rock.Mobile.Graphics.Util.UnitToPx(2); float textRightInset = textLeftInset * 2; float textBotInset = textTopInset * 2; float buttonWidth = Rock.Mobile.Graphics.Util.UnitToPx(122); float buttonHeight = Rock.Mobile.Graphics.Util.UnitToPx(44); GroupTitle.Hidden = false; GroupTitle.Frame = new RectangleF(textLeftInset, 0, View.Frame.Width - textRightInset, 0); GroupTitle.SizeToFit( ); GroupTitle.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, GroupTitle.Bounds.Height); // layout the meeting itme MeetingTime.Hidden = false; MeetingTime.Frame = new RectangleF(textLeftInset, GroupTitle.Frame.Bottom, View.Frame.Width - textRightInset, 0); MeetingTime.SizeToFit( ); MeetingTime.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, MeetingTime.Bounds.Height); float nextYPos = MeetingTime.Frame.Bottom; // layout the childcare banner if (string.IsNullOrWhiteSpace(ChildcareProvided.Text) == false) { ChildcareProvided.Hidden = false; ChildcareProvided.Frame = new RectangleF(textLeftInset, nextYPos, View.Frame.Width - textRightInset, 0); ChildcareProvided.SizeToFit( ); ChildcareProvided.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, ChildcareProvided.Bounds.Height); nextYPos = ChildcareProvided.Frame.Bottom; } else { ChildcareProvided.Hidden = true; } // layout the young adults banner if (string.IsNullOrWhiteSpace(YoungAdults.Text) == false) { YoungAdults.Hidden = false; YoungAdults.Frame = new RectangleF(textLeftInset, nextYPos, View.Frame.Width - textRightInset, 0); YoungAdults.SizeToFit( ); YoungAdults.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, YoungAdults.Bounds.Height); nextYPos = YoungAdults.Frame.Bottom; } else { YoungAdults.Hidden = true; } nextYPos += sectionSpacing; // layout the group description header (IF there's a description or group photo) if (string.IsNullOrWhiteSpace(GroupDesc.Text) == false || FamilyImageValid == true) { // display and position the header GroupDescHeader.Hidden = false; GroupDescHeader.Frame = new RectangleF(textLeftInset, nextYPos + textTopInset, View.Frame.Width - textRightInset, 0); GroupDescHeader.SizeToFit( ); GroupDescHeader.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, GroupDescHeader.Bounds.Height); nextYPos = GroupDescHeader.Frame.Bottom; // now try the image if (FamilyImageValid == true) { // setup padding for the image float imageTopPadding = textTopInset * 2; float imageBotPadding = textBotInset * 2; float leaderImageLayerHeight = Rock.Mobile.Graphics.Util.UnitToPx(PrivateConnectConfig.GroupInfo_Leader_ImageSize); FamilyImage.Hidden = false; FamilyImage.Position = new PointF((View.Frame.Width - FamilyImage.Frame.Width) / 2, nextYPos + imageTopPadding); FamilyImageLayer.Hidden = false; FamilyImageLayer.Frame = new RectangleF(0, nextYPos, View.Frame.Width, leaderImageLayerHeight + imageBotPadding); nextYPos = FamilyImageLayer.Frame.Bottom + sectionSpacing; } // try to layout the group description if (string.IsNullOrWhiteSpace(GroupDesc.Text) == false) { GroupDesc.Hidden = false; GroupDesc.Frame = new RectangleF(textLeftInset, nextYPos + textTopInset, View.Frame.Width - textRightInset, 0); GroupDesc.SizeToFit( ); GroupDesc.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, GroupDesc.Bounds.Height); GroupDescLayer.Hidden = false; GroupDescLayer.Frame = new RectangleF(0, nextYPos, View.Frame.Width, GroupDesc.Frame.Height + textBotInset); nextYPos = GroupDescLayer.Frame.Bottom + textBotInset + sectionSpacing; } // now try the image if (GroupImageValid == true) { // setup padding for the image float imageTopPadding = textTopInset * 2; float imageBotPadding = textBotInset * 2; float groupImageLayerHeight = Rock.Mobile.Graphics.Util.UnitToPx(PrivateConnectConfig.GroupInfo_Group_ImageSize); GroupImage.Hidden = false; GroupImage.Position = new PointF((View.Frame.Width - GroupImage.Frame.Width) / 2, nextYPos + imageTopPadding); GroupImageLayer.Hidden = false; GroupImageLayer.Frame = new RectangleF(0, nextYPos, View.Frame.Width, groupImageLayerHeight + imageBotPadding); nextYPos = GroupImageLayer.Frame.Bottom + sectionSpacing; } // regardless of which (or both) of the above displayed, add an additional sectionSpacing // so that the next major section, ChildDesc, has more spacing. nextYPos += sectionSpacing; } // layout the child info header if (string.IsNullOrWhiteSpace(ChildDesc.Text) == false) { ChildDescHeader.Hidden = false; ChildDescHeader.Frame = new RectangleF(textLeftInset, nextYPos + textTopInset, View.Frame.Width - textRightInset, 0); ChildDescHeader.SizeToFit( ); ChildDescHeader.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, ChildDescHeader.Bounds.Height); nextYPos = ChildDescHeader.Frame.Bottom; // layout child info ChildDesc.Hidden = false; ChildDesc.Frame = new RectangleF(textLeftInset, nextYPos + textTopInset, View.Frame.Width - textRightInset, 0); ChildDesc.SizeToFit( ); ChildDesc.Bounds = new RectangleF(0, 0, View.Frame.Width - textRightInset, ChildDesc.Bounds.Height); ChildDescLayer.Hidden = false; ChildDescLayer.Frame = new RectangleF(0, nextYPos, View.Frame.Width, ChildDesc.Frame.Height + textBotInset); nextYPos = ChildDescLayer.Frame.Bottom + sectionSpacing; } // Join Button JoinButton.Hidden = false; JoinButton.Frame = new RectangleF((View.Frame.Width - buttonWidth) / 2, nextYPos + sectionSpacing, buttonWidth, buttonHeight); } }
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); }
public override void ViewDidLayoutSubviews( ) { base.ViewDidLayoutSubviews( ); nfloat headerHeight = 0; ScrollView.Bounds = View.Bounds; // see if there's a safe area due to this being a "notch" device nfloat safeAreaTopInset = 0; nfloat safeAreaBotInset = 0; // Make sure they're on iOS 11 before checking for insets. This is only needed for iPhone X anyways, which shipped with iOS 11. if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { safeAreaTopInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Top; safeAreaBotInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Bottom; } // if there's no top safe area, there WILL be a header, so adjust for it. if (safeAreaTopInset == 0) { HeaderView.Frame = new CGRect(View.Frame.Left, 0, View.Frame.Width, StyledTextField.StyledFieldHeight); // setup the header shadow UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds); HeaderView.Layer.MasksToBounds = false; HeaderView.Layer.ShadowColor = UIColor.Black.CGColor; HeaderView.Layer.ShadowOffset = new CoreGraphics.CGSize(0.0f, .0f); HeaderView.Layer.ShadowOpacity = .23f; HeaderView.Layer.ShadowPath = shadowPath.CGPath; // the logo may not exist if we're on a display with a notch if (LogoView != null) { LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0); } headerHeight = HeaderView.Bounds.Height; // only move down the scrollview if there's a header ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Right, View.Frame.Bottom - headerHeight); } else { // otherwise, there's a safe area, so no header. We should therefore adjust the scrollview to be at the top of the window. ScrollView.Frame = new CGRect(View.Frame.Left, View.Frame.Top + safeAreaTopInset, View.Frame.Right, View.Frame.Bottom - (safeAreaBotInset + safeAreaTopInset)); } UserNameField.SetFrame(new CGRect(-10, View.Frame.Height * .10f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); PasswordField.SetFrame(new CGRect(UserNameField.Background.Frame.Left, UserNameField.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); // use the facebook image's button width, as it looks good. nfloat buttonWidth = FBImageView.Bounds.Width; LoginButton.Frame = new CGRect((ScrollView.Bounds.Width - buttonWidth) / 2, PasswordField.Background.Frame.Bottom + 20, buttonWidth, ControlStyling.ButtonHeight); LoginResult.SetFrame(new CGRect(UserNameField.Background.Frame.Left, LoginButton.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); AdditionalOptions.Frame = new CGRect((View.Bounds.Width - AdditionalOptions.Bounds.Width) / 2, LoginResult.Background.Frame.Bottom + 10, AdditionalOptions.Bounds.Width, ControlStyling.ButtonHeight); // setup the "Forgot account, Register or Facebook" ForgotPasswordButton.Frame = new CGRect((View.Bounds.Width - buttonWidth) / 2, AdditionalOptions.Frame.Bottom + 5, buttonWidth, ControlStyling.ButtonHeight); RegisterButton.Frame = new CGRect((View.Bounds.Width - buttonWidth) / 2, ForgotPasswordButton.Frame.Bottom + 15, buttonWidth, ControlStyling.ButtonHeight); OrSpacerLabel.Frame = new CGRect((View.Bounds.Width - OrSpacerLabel.Bounds.Width) / 2, RegisterButton.Frame.Bottom + 5, OrSpacerLabel.Bounds.Width, FBImageView.Bounds.Height); FacebookLogin.Frame = new CGRect((View.Bounds.Width - FBImageView.Bounds.Width) / 2, OrSpacerLabel.Frame.Bottom + 5, FBImageView.Bounds.Width, FBImageView.Bounds.Height); // CancelButton.Frame = new CGRect((View.Frame.Width - CancelButton.Frame.Width) / 2, FacebookLogin.Frame.Bottom + 20, CancelButton.Frame.Width, CancelButton.Frame.Height); FBImageView.Layer.Position = new CoreGraphics.CGPoint(FacebookLogin.Bounds.Width / 2, FacebookLogin.Bounds.Height / 2); if (WebLayout != null) { WebLayout.LayoutChanged(new CGRect(0, 0, ScrollView.Frame.Width, ScrollView.Frame.Height)); } BlockerView.SetBounds(View.Frame.ToRectF( )); ScrollView.ContentSize = new CGSize(View.Bounds.Width, Math.Max(ScrollView.Bounds.Height * 1.02f, CancelButton.Frame.Bottom + 20 + headerHeight)); }