public static void GetAdSize(string arg, ref int width, ref int height) { AdSize adSize = GetAdSize(arg); width = (int)adSize.Size.Width; height = (int)adSize.Size.Height; if (width == 0 || height == 0) { var screenSize = UtilsiOS.GetScreenSize(); width = (int)screenSize.Width; if (screenSize.Height <= 400) { height = 16; } else if (screenSize.Height <= 720) { height = 25; } else { height = 45; } } }
public static void ShowToast(String message, UIColor fgColor = null, UIColor bgColor = null, double duration = 10.0f, float width = 320, float height = 60) { if (fgColor == null) { fgColor = UIColor.White; } if (bgColor == null) { bgColor = UIColor.Gray; } width = (float)iOSApp.AdjustSize(width); CGSize screen = UtilsiOS.GetScreenSize(); var size = new CGSize(width, height); var x = (screen.Width - size.Width) / 2.0; var y = screen.Height - size.Height - 120 * WidthMultiplier(); var point = new CGPoint(x, y); UIView view = AppDelegate.GetCurrentView(); ShowToast(message, fgColor, bgColor, view, point, size, duration); }
public CGSize GetParentSize() { if (ParentView != null) { return(new CGSize(ParentView.Width, ParentView.Height)); } return(UtilsiOS.GetScreenSize()); }
void CreatePicker() { if (!m_init) { Forms.Init(); SfPickerRenderer.Init(); m_init = true; } m_picker = new SfPicker(); ViewX = UtilsiOS.ConvertFormsToNative(m_picker, m_rect); string str1 = "", str2 = "", str3 = "", str4 = ""; Utils.Extract(m_data, ref str1, ref str2, ref str3, ref str4); if (!string.IsNullOrEmpty(str1)) { double rowHeight = Utils.ConvertToDouble(str1); if (rowHeight > 0) { rowHeight = AutoScaleFunction.TransformSize((int)rowHeight, (int)UtilsiOS.GetScreenSize().Width); m_picker.ItemHeight = rowHeight; } } m_picker.ShowHeader = !string.IsNullOrEmpty(str2); if (m_picker.ShowHeader) { m_picker.HeaderHeight = 40; m_picker.HeaderText = str2; } m_picker.ShowColumnHeader = !string.IsNullOrEmpty(str3); if (m_picker.ShowColumnHeader) { m_picker.ColumnHeaderHeight = 40; m_picker.ColumnHeaderText = str3; } m_picker.ShowFooter = false; m_picker.SelectedIndex = 0; m_picker.PickerMode = PickerMode.Default; m_picker.PickerWidth = m_rect.Width; m_picker.PickerHeight = m_rect.Height; m_picker.BackgroundColor = Color.Transparent; m_picker.HeaderBackgroundColor = Color.Transparent; m_picker.ColumnHeaderBackgroundColor = Color.Transparent; m_picker.HeaderTextColor = Color.Black; m_picker.UnSelectedItemTextColor = Color.LightGray; m_picker.SelectedItemTextColor = Color.Black; m_picker.SelectionChanged += (sender, e) => { ActionDelegate?.Invoke(WidgetName, e.NewValue.ToString()); }; m_picker.OnPickerItemLoaded += (sender, e) => { if (m_pics == null) { return; } int row = e.Row; CustomRowView view = new CustomRowView(m_rect.Width); if (m_pics.Count > row) { UIImageView rowPic = new UIImageView(m_pics[row]); view.AddSubview(rowPic); } if (m_strings != null && m_strings.Count > row) { UILabel rowText = new UILabel(); rowText.Text = m_strings[row]; rowText.TextAlignment = m_alignment; rowText.BackgroundColor = m_bgColor; //rowText.BackgroundColor = UIColor.Clear; rowText.TextColor = m_fontColor; view.AddSubview(rowText); } e.View = view.ToView(); }; m_picker.HeaderFontSize = m_picker.ColumnHeaderFontSize = m_picker.SelectedItemFontSize = m_picker.UnSelectedItemFontSize = 15; }