public override void ViewDidLoad() { base.ViewDidLoad(); // Create toolbar, title label and button var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; toolBar.BarStyle = UIBarStyle.Black; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.TextColor = UIColor.White; toolBarTitle.Font = UIFont.SystemFontOfSize(18.0f); toolBarTitle.Text = "Note".t(); var btnNavigate = new UIButton(new RectangleF(5, 5, 30, 30)); btnNavigate.SetImage(UIImage.FromFile("Images/Toolbar/Save32.png"), UIControlState.Normal); btnNavigate.TouchUpInside += delegate { _Note.Note = _TxtNote.Text; MgrAccessor.DocumentNoteMgr.Save(_Note); _PopoverController.Dismiss(true); }; toolBar.AddSubview(toolBarTitle); toolBar.AddSubview(btnNavigate); View.AddSubview(toolBar); // Create text note _TxtNote = new UITextView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height)); _TxtNote.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _TxtNote.Font = UIFont.SystemFontOfSize(17.0f); _TxtNote.Text = _Note.Note; View.AddSubview(_TxtNote); }
void ReleaseDesignerOutlets () { if (switchToolbar != null) { switchToolbar.Dispose (); switchToolbar = null; } }
public static void UiSetKeyboardEditorWithCloseButton(this UITextField txt, UIKeyboardType keyboardType) { var toolbar = new UIToolbar { BarStyle = UIBarStyle.Black, Translucent = true, }; txt.KeyboardType = keyboardType; toolbar.SizeToFit(); var text = new UITextView(new CGRect(0, 0, 200, 32)) { ContentInset = UIEdgeInsets.Zero, KeyboardType = keyboardType, Text = txt.Text, UserInteractionEnabled = true }; text.Layer.CornerRadius = 4f; text.BecomeFirstResponder(); var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { text.ResignFirstResponder(); txt.ResignFirstResponder(); }); toolbar.UserInteractionEnabled = true; toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true); txt.InputAccessoryView = toolbar; }
public override void ViewDidLoad () { base.ViewDidLoad (); string selectedColor = ""; PickerModel model = new PickerModel(); model.ValueChanged += (sender, e) => { selectedColor = model.SelectedItem; }; UIPickerView picker = new UIPickerView(); picker.ShowSelectionIndicator = false; picker.BackgroundColor = UIColor.White; picker.Model = model; this.color.Text = model.SelectedItem; UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; toolbar.SizeToFit(); UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { this.color.Text = selectedColor; this.color.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true); this.color.InputView = picker; this.color.InputAccessoryView = toolbar; }
public override void ViewDidLoad () { base.ViewDidLoad (); this.NavigationItem.HidesBackButton = true; if(isFrom == "") setAccountResponse (Constant.selectedAffialte ); Appdata.setButtonBorder (btnSave); btnSave.BackgroundColor = Appdata.buttonBackgroundColor; if (UserInterfaceIsPhone) SetLayoytIPhone (); else SetLayoytIPad (); UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; toolbar.SizeToFit(); // Create a 'done' button for the toolbar and add it to the toolbar UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { Console.WriteLine ("Calling Done!"); }); toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true); }
public static PriceTileViewCell Create () { PriceTileViewCell created = (PriceTileViewCell)Nib.Instantiate (null, null) [0]; created.ContentView.BackgroundColor = Styles.RTDarkerBlue; created.Notional.Delegate = new NotionalTextFieldDelegate (created); var numberToolbar = new UIToolbar (new RectangleF(0.0f, 0.0f, created.Frame.Size.Width, 40.0f)); numberToolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, created, new MonoTouch.ObjCRuntime.Selector ("CancelNumberPad")), new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem (UIBarButtonSystemItem.Done, created, new MonoTouch.ObjCRuntime.Selector ("DoneNumberPad")) }; created.Notional.InputAccessoryView = numberToolbar; // // TODO: Reinstate change of notional currency once data model / back end support this. // For now we just disable the button (not that some relevant implementation of the button click remains). // created.NotionalCCY.UserInteractionEnabled = false; UserModel.Instance.OnChanged .Subscribe (created.OnUserModelChanged); created.DecorateWithTradingEnabled (UserModel.Instance.OneTouchTradingEnabled); return created; }
void ReleaseDesignerOutlets () { if (myToolBar != null) { myToolBar.Dispose (); myToolBar = null; } }
public override void ViewDidLoad() { base.ViewDidLoad (); navBar = new UIToolbar (); navBar.Frame = new RectangleF (0, this.View.Frame.Height-130, this.View.Frame.Width, 40); items = new UIBarButtonItem [] { new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack (); }), new UIBarButtonItem ("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward (); }), new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null), new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload (); }), new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading (); }) }; navBar.Items = items; SetNavBarColor(); webView = new UIWebView (); webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-130); webView.LoadStarted += delegate { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; }; webView.LoadFinished += delegate { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; webView.ScalesPageToFit = true; webView.SizeToFit (); webView.LoadRequest (url); this.View.AddSubview (webView); this.View.AddSubview (navBar); }
public override void ViewDidLoad() { base.ViewDidLoad (); _table = new UITableView (new RectangleF (0, 44, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 44), UITableViewStyle.Plain); this.View.AddSubview (_table); _toolbar = new UIToolbar (); _toolbar.BarStyle = UIBarStyle.Black; _toolbar.Frame = new RectangleF (0, 0, UIScreen.MainScreen.Bounds.Width, 44); this.View.AddSubview (_toolbar); _editButton = new UIBarButtonItem (); _editButton.Style = UIBarButtonItemStyle.Bordered; _editButton.Title = "Edit"; _editButton.Clicked += delegate { if (_table.Editing) { _table.SetEditing (false, true); _editButton.Title = "Edit"; } else { _table.SetEditing (true, true); _editButton.Title = "Done"; } }; _closeButton = new UIBarButtonItem (); _closeButton.Style = UIBarButtonItemStyle.Bordered; _closeButton.Title = "Close"; _closeButton.Clicked += delegate { SelectedSpeechItem = null; this.DismissModalViewControllerAnimated (true); }; _toolbar.Items = new UIBarButtonItem[] { _closeButton, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), _editButton }; }
public override void ViewDidLoad() { base.ViewDidLoad (); for (int i = 0; i<3; i++) { this.AddItem (); } this.dataSource.ItemSource = this.items; this.toolbar = new UIToolbar(new CGRect(0, this.View.Bounds.Y, this.View.Frame.Width, 44)); this.toolbar.Items = new UIBarButtonItem[]{ new UIBarButtonItem("Add", UIBarButtonItemStyle.Plain, this.AddTouched), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Remove", UIBarButtonItemStyle.Plain, this.RemoveTouched), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Update", UIBarButtonItemStyle.Plain, this.UpdateTouched), }; toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; this.View.AddSubview (toolbar); this.listView = new TKListView (new CGRect(0, this.View.Bounds.Y + 44, this.View.Frame.Width, this.View.Bounds.Height - 44)); this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.listView.WeakDataSource = this.dataSource; this.listView.Delegate = new ListViewDelegate(this); this.View.AddSubview (this.listView); this.toolbar.Items[2].Enabled = false; this.toolbar.Items[4].Enabled = false; }
public override void ViewWillAppear(bool animated) { if (_secondaryItems != null && _secondaryItems.Count > 0) { var tools = new List<UIBarButtonItem> (); _buttonCommands.Clear (); foreach (var tool in _secondaryItems) { #pragma warning disable 618 var systemItemName = tool.Name; #pragma warning restore 618 UIBarButtonItem button; UIBarButtonSystemItem systemItem; button = Enum.TryParse<UIBarButtonSystemItem> (systemItemName, out systemItem) ? new UIBarButtonItem (systemItem, ToolClicked) : new UIBarButtonItem (tool.Text, UIBarButtonItemStyle.Plain, ToolClicked); _buttonCommands.Add (button, tool.Command); tools.Add (button); } NavigationController.SetToolbarHidden (false, animated); _toolbar = new UIToolbar (CGRect.Empty) { Items = tools.ToArray () }; NavigationController.View.Add (_toolbar); } base.ViewWillAppear (animated); }
public UIBlurView() { BackgroundColor = UIColor.Clear; Add(toolbar = new UIToolbar { Translucent =true, }); }
public override void ViewDidLoad() { base.ViewDidLoad (); table = new UITableView (new RectangleF (0, 64, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 44), UITableViewStyle.Plain); View.AddSubview (table); toolbar = new UIToolbar (); toolbar.BarStyle = UIBarStyle.Default; toolbar.Frame = new RectangleF (0, 20, UIScreen.MainScreen.Bounds.Width, 44); View.AddSubview (toolbar); editButton = new UIBarButtonItem (); editButton.Style = UIBarButtonItemStyle.Bordered; editButton.Title = "Edit"; editButton.Clicked += delegate { if (table.Editing) { table.SetEditing (false, true); editButton.Title = "Edit"; } else { table.SetEditing (true, true); editButton.Title = "Done"; } }; closeButton = new UIBarButtonItem (); closeButton.Style = UIBarButtonItemStyle.Bordered; closeButton.Title = "Close"; closeButton.Clicked += delegate { SelectedSpeechItem = null; DismissViewController (true, null); }; toolbar.Items = new UIBarButtonItem[] { closeButton, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), editButton }; }
public override void ViewDidLoad () { base.ViewDidLoad (); navBar = new UIToolbar(); navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40); navBar.TintColor = UIColor.Gray; items = new [] { new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading (); DismissViewController (true, null); }), new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null), new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => webView.Reload ()) }; navBar.Items = items; webView = new UIWebView (); webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40); webView.ScalesPageToFit = true; webView.SizeToFit (); webView.LoadRequest (url); navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.AddSubviews (new UIView[] { webView, navBar }); }
public override void ViewDidLoad() { base.ViewDidLoad(); //Text Field message = new UITextField(new RectangleF(0, 0, 240, 32)) { BorderStyle = UITextBorderStyle.RoundedRect, ReturnKeyType = UIReturnKeyType.Send, ShouldReturn = _ => { Send(); return false; }, }; //Bar button item send = new UIBarButtonItem("Send", UIBarButtonItemStyle.Plain, (sender, e) => Send()); //Toolbar toolbar = new UIToolbar(new RectangleF(0, TableView.Frame.Height - 44, TableView.Frame.Width, 44)); toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(message), send }; NavigationController.View.AddSubview(toolbar); TableView.Source = new TableSource(); TableView.TableFooterView = new UIView(new RectangleF(0, 0, TableView.Frame.Width, 44)) { BackgroundColor = UIColor.Clear, }; }
private void SetupPicker() { // Setup the picker and model PickerModel model = new PickerModel(this.colors); model.PickerChanged += (sender, e) => { this.selectedColor = e.SelectedValue; }; UIPickerView picker = new UIPickerView(); picker.ShowSelectionIndicator = true; picker.Model = model; // Setup the toolbar UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Black; toolbar.Translucent = true; toolbar.SizeToFit(); // Create a 'done' button for the toolbar and add it to the toolbar UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { this.ColorTextField.Text = selectedColor; this.ColorTextField.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true); // Tell the textbox to use the picker for input this.ColorTextField.InputView = picker; // Display the toolbar over the pickers this.ColorTextField.InputAccessoryView = toolbar; }
public UICurrencyTextField(IntPtr handle) : base(handle) { unitPicker = new CurrencyPickerView(); // Setup the unitToolbar UIToolbar unitToolbar = new UIToolbar(); unitToolbar.BarStyle = UIBarStyle.Black; unitToolbar.Translucent = true; unitToolbar.SizeToFit(); // Create a 'done' button for the unitToolbar UIBarButtonItem unitDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { base.Text = unitPicker.SelectedValue; this.selectedIndex = unitPicker.SelectedKey; this.ResignFirstResponder(); }); // Create flexible space UIBarButtonItem unitFlex = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); // Add button and unitFlexible space to the unitToolbar unitToolbar.SetItems(new UIBarButtonItem[]{unitFlex, unitDoneButton}, true); // Tell the textbox to use the picker for input this.InputView = unitPicker; // Display the toolbar over the pickers this.InputAccessoryView = unitToolbar; }
public UIMonthTextField(IntPtr handle) : base(handle) { monthPicker = new MonthPickerView(); // Setup the toolbar UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Black; toolbar.Translucent = true; toolbar.SizeToFit(); // Create a 'done' button for the toolbar UIBarButtonItem unitDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { this.Text = monthPicker.SelectedDate.ToString(this.format); this._currentDate = monthPicker.SelectedDate; this.ResignFirstResponder(); }); // Create flexible space UIBarButtonItem unitFlex = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); // Add button and unitFlexible space to the toolbar toolbar.SetItems(new UIBarButtonItem[]{unitFlex, unitDoneButton}, true); // Tell the textbox to use the picker for input this.InputView = monthPicker; // Display the toolbar over the pickers this.InputAccessoryView = toolbar; }
public override void ViewDidLoad () { base.ViewDidLoad (); UIDatePicker datePicker = new UIDatePicker (); datePicker.Mode = UIDatePickerMode.Date; datePicker.BackgroundColor = UIColor.White; datePicker.MinimumDate = DateTime.Today.AddDays(-7); datePicker.MaximumDate = DateTime.Today.AddDays(7); UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; toolbar.SizeToFit(); UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { DateTime dateTime = DateTime.SpecifyKind(datePicker.Date, DateTimeKind.Unspecified); this.textField.Text = dateTime.ToString("MM-dd-yyyy"); this.textField.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true); this.textField.InputAccessoryView = toolbar; textField.InputView = datePicker; }
/// <summary> /// Add toolbar with Done button /// </summary> protected void AddDoneButton() { UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { this.Control .ResignFirstResponder(); }); toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneButton }; Control.InputAccessoryView = toolbar; /* var protocol = Runtime.GetProtocol("UITextField"); UITextField searchBarField; foreach (UIView subView in Control.Subviews) { if (subView.ConformsToProtocol(protocol)) { searchBarField = (UITextField) subView; searchBarField.InputAccessoryView = toolbar; } }*/ }
private void SetupToolbar() { toolbar = new UIToolbar (new CoreGraphics.CGRect (0, 0, 0, 44)); textbox = new UITextView (CoreGraphics.CGRect.FromLTRB (0, 0, 0, 0)); textbox.BackgroundColor = UIColor.White; //textbox.Delegate = new TextDelegate (); textbox.Font = UIFont.SystemFontOfSize (UIFont.SystemFontSize); textbox.Layer.BorderColor = UIColor.FromRGB ((nfloat)200 / 255, (nfloat)200 / 255, (nfloat)200 / 255).CGColor; textbox.Layer.BorderWidth = (nfloat)0.5; textbox.Layer.CornerRadius = 5; textbox.ScrollsToTop = false; textbox.TextContainerInset = new UIEdgeInsets (3, 3, 3, 3); toolbar.AddSubview (textbox); sendButton = new UIButton (UIButtonType.System); sendButton.Enabled = false; sendButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize (UIFont.SystemFontSize); sendButton.SetTitle ("Send", UIControlState.Normal); sendButton.SetTitleColor (UIColor.FromRGB (142, 142, 142), UIControlState.Disabled); sendButton.SetTitleColor (UIColor.FromRGB (1, 122, 255), UIControlState.Normal); sendButton.ContentEdgeInsets = new UIEdgeInsets (6, 6, 6, 6); //sendButton.AddTarget (sendAction, UIControlEvent.TouchUpInside); toolbar.AddSubview (sendButton); textbox.TranslatesAutoresizingMaskIntoConstraints = false; sendButton.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Left, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Left, 1, 8)); toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Top, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Top, 1, 8)); toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Right, NSLayoutRelation.Equal, sendButton, NSLayoutAttribute.Left, 1, -2)); toolbar.AddConstraint (NSLayoutConstraint.Create (textbox, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1, -8)); toolbar.AddConstraint (NSLayoutConstraint.Create (sendButton, NSLayoutAttribute.Right, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Right, 1, 0)); toolbar.AddConstraint (NSLayoutConstraint.Create (sendButton, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1, -5)); }
protected override void OnElementChanged (ElementChangedEventArgs<Editor> e) { base.OnElementChanged (e); var toolbar = new UIToolbar(new CGRect(0.0f, 0.0f, Control.Frame.Size.Width, 44.0f)); toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Send",UIBarButtonItemStyle.Plain, delegate { Control.ResignFirstResponder(); }) }; this.Control.InputAccessoryView = toolbar; Control.TranslatesAutoresizingMaskIntoConstraints = false; if (Control != null) { Control.BackgroundColor = InputBackgroundColor; Control.ScrollIndicatorInsets = new UIEdgeInsets (CornerRadius, 0f, CornerRadius, 0f); Control.TextContainerInset = new UIEdgeInsets (4f, 2f, 4f, 2f); Control.ContentInset = new UIEdgeInsets (1f, 0f, 10f, 0f); Control.ScrollEnabled = false; Control.ScrollsToTop = false; Control.UserInteractionEnabled = true; Control.Font = UIFont.SystemFontOfSize (16f); Control.TextAlignment = UITextAlignment.Natural; //Control.ContentMode = UIViewContentMode.Redraw; } Control.Layer.BorderColor = InputBorderColor.CGColor; Control.Layer.BorderWidth = BorderWidth; Control.Layer.CornerRadius = CornerRadius; Control.TextColor = UIColor.Gray; Control.Text = "Type a Message..."; Control.Started += (object sender, EventArgs m) => { Control.ScrollEnabled = false; Control.ScrollsToTop = false; Control.UserInteractionEnabled = true; Control.TextColor = UIColor.Black; Control.Text = ""; }; Control.Changed += (object sender, EventArgs m) => { }; Control.Ended += (object sender, EventArgs m) => { Control.Text = Control.Text.Remove(0,Control.Text.Length-1); Control.TextColor = UIColor.LightGray; }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create a variable to hold the yOffset where the MapView control should start var yOffset = 60; // Create a new MapView control and provide its location coordinates on the frame MapView myMapView = new MapView(); myMapView.Frame = new CoreGraphics.CGRect(0, yOffset, View.Bounds.Width, View.Bounds.Height - yOffset); // Create a new Map instance with the basemap var myBasemap = Basemap.CreateStreets(); Map myMap = new Map(myBasemap); // Assign the Map to the MapView myMapView.Map = myMap; // Create a label to display the MapView rotation value UILabel rotationLabel = new UILabel(); rotationLabel.Frame = new CoreGraphics.CGRect(View.Bounds.Width - 60, 8, View.Bounds.Width, 24); rotationLabel.Text = string.Format("{0:0}°", myMapView.MapRotation); // Create a slider to control the MapView rotation UISlider rotationSlider = new UISlider() { MinValue = 0, MaxValue = 360, Value = (float)myMapView.MapRotation }; rotationSlider.Frame = new CoreGraphics.CGRect(10, 8, View.Bounds.Width - 100, 24); rotationSlider.ValueChanged += (Object s, EventArgs e) => { myMapView.SetViewpointRotationAsync(rotationSlider.Value); rotationLabel.Text = string.Format("{0:0}°", rotationSlider.Value); }; // Create a UIBarButtonItem where its view is the rotation slider UIBarButtonItem barButtonSlider = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); barButtonSlider.CustomView = rotationSlider; // Create a UIBarButtonItem where its view is the rotation label UIBarButtonItem barButtonLabel = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); barButtonLabel.CustomView = rotationLabel; // Create a toolbar on the bottom of the display UIToolbar toolbar = new UIToolbar(); toolbar.Frame = new CoreGraphics.CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, View.Bounds.Height); toolbar.AutosizesSubviews = true; // Add the bar button items to an array of UIBarButtonItems UIBarButtonItem[] barButtonItems = new UIBarButtonItem[] { barButtonSlider, barButtonLabel }; // Add the UIBarButtonItems array to the toolbar toolbar.SetItems(barButtonItems, true); View.AddSubviews(myMapView, toolbar); }
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e) { base.OnElementChanged(e); var element = this.Element as ConversationEditor; if (Control != null && element != null) { Placeholder = element.Placeholder; if (Control.Text == "" || Control.Text == Placeholder) { Control.TextColor = App.PlaceHolderColor.ToUIColor(); Control.Text = Placeholder; } else { Control.TextColor = App.NormalTextColor.ToUIColor(); } //Control.Layer.BorderColor = Color.White.ToCGColor(); Control.Layer.BorderWidth = 0; Control.Layer.CornerRadius = 4; Control.TextAlignment = UITextAlignment.Left; Control.ShouldBeginEditing += (UITextView textView) => { if (textView.Text == Placeholder) { textView.Text = ""; textView.TextColor = App.NormalTextColor.ToUIColor(); // Text Color } return true; }; Control.ShouldEndEditing += (UITextView textView) => { if (textView.Text == "") { textView.Text = Placeholder; textView.TextColor = App.PlaceHolderColor.ToUIColor(); // Placeholder Color } return true; }; } var toolbar = new UIToolbar(new CGRect(0.0f, 0.0f, Control.Frame.Size.Width, 44.0f)); toolbar.Items = new[] { new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, delegate { Control.ResignFirstResponder(); }), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Send", UIBarButtonItemStyle.Plain, delegate { App.coreView.viewdConversation.pushPostNewComment(); }) }; this.Control.InputAccessoryView = toolbar; }
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e) { base.OnElementChanged(e); var toolbar = new UIToolbar(new CGRect(0.0f, 0.0f, Control.Frame.Size.Width, 44.0f)); toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Done", UIBarButtonItemStyle.Plain, delegate { Control.ResignFirstResponder(); }) }; this.Control.InputAccessoryView = toolbar; if (this.Control != null) { this.Control.Layer.BorderWidth = 1; this.Control.Layer.BorderColor = App.HowlOutBackground.ToCGColor(); this.Control.TextAlignment = UITextAlignment.Left; } }
public override void ViewWillDisappear(bool animated) { if (_toolbar != null) { NavigationController.SetToolbarHidden (true, animated); _toolbar.RemoveFromSuperview (); _toolbar = null; } base.ViewWillDisappear (animated); }
public MGDetailViewController(MGSplitViewController splitController) { this.splitController = splitController; toolbar = new UIToolbar(); toggleItem = new UIBarButtonItem(); verticalItem = new UIBarButtonItem(); dividerStyleItem = new UIBarButtonItem(); masterBeforeDetailItem = new UIBarButtonItem(); }
public override void ViewDidLoad () { base.ViewDidLoad (); navBar = new UIToolbar (); if (AppDelegate.IsPhone) navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40); else navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40); navBar.TintColor = UIColor.DarkGray; items = new UIBarButtonItem [] { new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack (); }), new UIBarButtonItem ("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward (); }), new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null), new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload (); }), new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading (); // Phone: NavigationController, Pad: Modal if (NavigationController == null) DismissViewController (true, ()=> {}); else NavigationController.PopViewController (true); }) }; navBar.Items = items; webView = new UIWebView (); if (AppDelegate.IsPhone) webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40); else webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40); webView.LoadStarted += delegate { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; navBar.Items[0].Enabled = webView.CanGoBack; navBar.Items[1].Enabled = webView.CanGoForward; }; webView.LoadFinished += delegate { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; navBar.Items[0].Enabled = webView.CanGoBack; navBar.Items[1].Enabled = webView.CanGoForward; }; webView.ScalesPageToFit = true; webView.SizeToFit (); webView.LoadRequest (url); navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.AddSubview (webView); View.AddSubview (navBar); }
void ReleaseDesignerOutlets () { if (skullImg != null) { skullImg.Dispose (); skullImg = null; } if (SwitchToolbar != null) { SwitchToolbar.Dispose (); SwitchToolbar = null; } }
void ReleaseDesignerOutlets () { if (BarBut != null) { BarBut.Dispose (); BarBut = null; } if (ToolBar != null) { ToolBar.Dispose (); ToolBar = null; } }
protected override void OnElementChanged(ElementChangedEventArgs <Editor> e) { base.OnElementChanged(e); try { if (Control != null) { if (_placeholderLabel == null) { CreatePlaceholder(); } } var view = (CustomEditor)Element; if (view != null && Control != null) { SetDoneButton(view); Control.TintColor = view.TextColor.ToUIColor(); Control.Layer.BorderWidth = 0; Control.LayoutManager.AllowsNonContiguousLayout = false; Control.ScrollRangeToVisible(new NSRange(Control.Text.Length - 1, 1)); if (view.IsExpandable) { Control.ScrollEnabled = false; } else { Control.ScrollEnabled = true; } var toolbar = new UIToolbar(new CGRect(0.0f, 0.0f, Control.Frame.Size.Width, 44.0f)); //var doneButton = new UIBarButtonItem(TextResources.SecurityCodeText9, UIBarButtonItemStyle.Plain, (o, a) => { // Control.ResignFirstResponder(); // if (view.ReturnCommand != null) // { // view.ReturnCommand.Execute(this); // } //}); var nextButton = new UIBarButtonItem("Next", UIBarButtonItemStyle.Plain, (o, a) => { Control.ResignFirstResponder(); ((IEntryController)Element).SendCompleted(); }); if (view.ReturnType == ReturnType.Next) { toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), nextButton }; } else if (view.ReturnType == ReturnType.Done) { //toolbar.Items = new[] //{ // new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), // doneButton // }; } this.Control.InputAccessoryView = toolbar; } if (e.NewElement != null) { var customControl = (CustomEditor)e.NewElement; if (customControl.IsExpandable) { Control.ScrollEnabled = false; } else { Control.ScrollEnabled = true; } //Control.InputAccessoryView = new UIView(CGRect.Empty); // Control.InputAccessoryView = UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { this.Control.ResignFirstResponder(); }); doneButton.TintColor = UIColor.Black; toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneButton }; this.Control.InputAccessoryView = toolbar; Control.ReloadInputViews(); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
void initUI() { View.ContentMode = UIViewContentMode.ScaleToFill; View.LayoutMargins = new UIEdgeInsets(0, 16, 0, 16); View.Frame = new CGRect(0, 0, 375, 667); View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; inputLabel = new UILabel { Frame = new CGRect(0, 0, 375, 20), Opaque = false, UserInteractionEnabled = false, ContentMode = UIViewContentMode.Left, Text = "翻訳したい日本語", TextAlignment = UITextAlignment.Left, LineBreakMode = UILineBreakMode.TailTruncation, Lines = 0, BaselineAdjustment = UIBaselineAdjustment.AlignBaselines, AdjustsFontSizeToFitWidth = false, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(fontSize), }; View.AddSubview(inputLabel); inputLabel.HeightAnchor.ConstraintEqualTo(20).Active = true; inputLabel.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true; inputLabel.TopAnchor.ConstraintEqualTo(View.TopAnchor, 70).Active = true; inputLabel.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active = true; inputLabel.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true; inputText = new UITextView { Frame = new CGRect(0, 0, 375, 200), ContentMode = UIViewContentMode.ScaleToFill, TranslatesAutoresizingMaskIntoConstraints = false, KeyboardType = UIKeyboardType.Twitter, Font = UIFont.SystemFontOfSize(fontSize), AccessibilityIdentifier = "inputText", }; inputText.Layer.BorderWidth = 1; inputText.Layer.BorderColor = UIColor.LightGray.CGColor; View.AddSubview(inputText); inputText.HeightAnchor.ConstraintEqualTo(View.HeightAnchor, 0.3f).Active = true; inputText.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true; inputText.TopAnchor.ConstraintEqualTo(inputLabel.BottomAnchor, 5).Active = true; inputText.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active = true; inputText.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true; var toolBar = new UIToolbar { BarStyle = UIBarStyle.Default, TranslatesAutoresizingMaskIntoConstraints = false, }; toolBar.HeightAnchor.ConstraintEqualTo(40).Active = true; toolBar.WidthAnchor.ConstraintEqualTo(View.Frame.Width).Active = true; var spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var commitButton = new UIBarButtonItem(UIBarButtonSystemItem.Done); commitButton.Clicked += (s, e) => View.EndEditing(true); toolBar.SetItems(new UIBarButtonItem[] { spacer, commitButton }, false); inputText.InputAccessoryView = toolBar; translateButton = new UIButton(UIButtonType.RoundedRect) { Frame = new CGRect(0, 0, 375, 20), Opaque = false, ContentMode = UIViewContentMode.ScaleToFill, HorizontalAlignment = UIControlContentHorizontalAlignment.Center, VerticalAlignment = UIControlContentVerticalAlignment.Center, LineBreakMode = UILineBreakMode.MiddleTruncation, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(fontSize), AccessibilityIdentifier = "translateButton", }; translateButton.SetTitle("英語に翻訳する", UIControlState.Normal); View.AddSubview(translateButton); translateButton.HeightAnchor.ConstraintEqualTo(40f).Active = true; translateButton.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true; translateButton.TopAnchor.ConstraintEqualTo(inputText.BottomAnchor, 20).Active = true; translateButton.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active = true; translateButton.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true; translatedLabel = new UILabel { Frame = new CGRect(0, 0, 375, 20), Opaque = false, UserInteractionEnabled = false, ContentMode = UIViewContentMode.Left, Text = "翻訳された英語", TextAlignment = UITextAlignment.Left, LineBreakMode = UILineBreakMode.TailTruncation, Lines = 0, BaselineAdjustment = UIBaselineAdjustment.AlignBaselines, AdjustsFontSizeToFitWidth = false, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(fontSize), }; View.AddSubview(translatedLabel); translatedLabel.HeightAnchor.ConstraintEqualTo(20).Active = true; translatedLabel.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true; translatedLabel.TopAnchor.ConstraintEqualTo(translateButton.BottomAnchor, 20).Active = true; translatedLabel.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active = true; translatedLabel.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true; translatedText = new UITextView { Frame = new CGRect(0, 0, 375, 200), ContentMode = UIViewContentMode.ScaleToFill, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(fontSize), AccessibilityIdentifier = "translatedText", Editable = false, }; translatedText.Layer.BorderWidth = 1; translatedText.Layer.BorderColor = UIColor.LightGray.CGColor; View.AddSubview(translatedText); translatedText.HeightAnchor.ConstraintEqualTo(View.HeightAnchor, 0.3f).Active = true; translatedText.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true; translatedText.TopAnchor.ConstraintEqualTo(translatedLabel.BottomAnchor, 5).Active = true; translatedText.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active = true; translatedText.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _mySceneView = new SceneView(); _mySceneView.TranslatesAutoresizingMaskIntoConstraints = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; _playButton = new UIBarButtonItem(UIBarButtonSystemItem.Play) { Enabled = false }; _pauseButton = new UIBarButtonItem(UIBarButtonSystemItem.Pause) { Enabled = false }; _resetButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh) { Enabled = false }; toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _playButton, _pauseButton, _resetButton }; UILabel helpLabel = new UILabel { Text = "Use the buttons to play the tour. Contains audio. 🎧", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _loadingIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { TranslatesAutoresizingMaskIntoConstraints = false, HidesWhenStopped = true, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f) }; _loadingIndicator.StartAnimating(); // Add the views. View.AddSubviews(_mySceneView, toolbar, helpLabel, _loadingIndicator); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _mySceneView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _mySceneView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _mySceneView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _mySceneView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), helpLabel.HeightAnchor.ConstraintEqualTo(40), _loadingIndicator.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _loadingIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _loadingIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _loadingIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Keyboard popup _observer1 = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, KeyBoardUpNotification); // Keyboard Down _observer2 = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, KeyBoardDownNotification); if (App.Locator.AddSeekios.IsAdding) { // Seekios Name Toolbar (next -> go to IMEI) var toolbarName = new UIToolbar(); toolbarName.BarStyle = UIBarStyle.Default; toolbarName.Translucent = true; toolbarName.SizeToFit(); var nextNameButton = new UIBarButtonItem(Application.LocalizedString("Next"), UIBarButtonItemStyle.Done, (s, e) => { SeekiosNameTextField.ResignFirstResponder(); SeekiosIMEITextField.BecomeFirstResponder(); }); toolbarName.SetItems(new UIBarButtonItem[] { nextNameButton }, true); SeekiosNameTextField.InputAccessoryView = toolbarName; // Seekios IMEI Toolbar (next -> go to Pin Code) var toolbarIMEI = new UIToolbar(); toolbarIMEI.BarStyle = UIBarStyle.Default; toolbarIMEI.Translucent = true; toolbarIMEI.SizeToFit(); var nextIMEIButton = new UIBarButtonItem(Application.LocalizedString("Next"), UIBarButtonItemStyle.Done, (s, e) => { SeekiosIMEITextField.ResignFirstResponder(); SeekiosPinCodeTextField.BecomeFirstResponder(); }); toolbarIMEI.SetItems(new UIBarButtonItem[] { nextIMEIButton }, true); SeekiosIMEITextField.InputAccessoryView = toolbarIMEI; // Seekios Pin Code Toolbar (Done -> save the seekios) var toolbarPinCode = new UIToolbar(); toolbarPinCode.BarStyle = UIBarStyle.Default; toolbarPinCode.Translucent = true; toolbarPinCode.SizeToFit(); var nextPinCodeButton = new UIBarButtonItem(Application.LocalizedString("DoneButton"), UIBarButtonItemStyle.Done, (s, e) => { SeekiosPinCodeTextField.ResignFirstResponder(); SaveButton_TouchUpInside(null, null); }); toolbarPinCode.SetItems(new UIBarButtonItem[] { nextPinCodeButton }, true); SeekiosPinCodeTextField.InputAccessoryView = toolbarPinCode; } SeekiosImageView.AddGestureRecognizer(new UITapGestureRecognizer(() => { ModifySeekiosImageButton_TouchDown(null, null); })); ModifySeekiosImageButton.TouchDown += ModifySeekiosImageButton_TouchDown; DeleteButton.TouchUpInside += DeleteButton_TouchUpInside; BuySeekiosButton.TouchDown += BuySeekiosButton_TouchDown; SaveButton.TouchUpInside += SaveButton_TouchUpInside; NeedUpdateButton.TouchDown += NeedUpdateButton_TouchDown; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _staticSceneView = new SceneView(); _staticSceneView.TranslatesAutoresizingMaskIntoConstraints = false; _dynamicSceneView = new SceneView(); _dynamicSceneView.TranslatesAutoresizingMaskIntoConstraints = false; _stackView = new UIStackView(new UIView[] { _staticSceneView, _dynamicSceneView }); _stackView.TranslatesAutoresizingMaskIntoConstraints = false; _stackView.Distribution = UIStackViewDistribution.FillEqually; _zoomButton = new UIBarButtonItem(); _zoomButton.Title = "Zoom"; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _zoomButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; UILabel staticLabel = new UILabel { Text = "Static", BackgroundColor = UIColor.FromWhiteAlpha(0f, .6f), TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; UILabel dynamicLabel = new UILabel { Text = "Dynamic", BackgroundColor = UIColor.FromWhiteAlpha(0f, .6f), TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_stackView, toolbar, staticLabel, dynamicLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _stackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _stackView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _stackView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _stackView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), staticLabel.TopAnchor.ConstraintEqualTo(_staticSceneView.TopAnchor), staticLabel.HeightAnchor.ConstraintEqualTo(40), staticLabel.LeadingAnchor.ConstraintEqualTo(_staticSceneView.LeadingAnchor), staticLabel.TrailingAnchor.ConstraintEqualTo(_staticSceneView.TrailingAnchor), dynamicLabel.TopAnchor.ConstraintEqualTo(_dynamicSceneView.TopAnchor), dynamicLabel.HeightAnchor.ConstraintEqualTo(40), dynamicLabel.LeadingAnchor.ConstraintEqualTo(_dynamicSceneView.LeadingAnchor), dynamicLabel.TrailingAnchor.ConstraintEqualTo(_dynamicSceneView.TrailingAnchor) }); }
/// <summary> /// Setups the airlines. /// </summary> /// <param name="field">Field.</param> /// <param name="list">List.</param> /// <param name="direction">Direction 1 - Pick-Up and 2 - Drop-off </param> protected void SetupAirlines(UITextField field, List <KeyValuePair <object, string> > list, int direction = 0) { // Setup the picker and model MyPickerModel model = new MyPickerModel(list); if (direction == 1) { Facade.Instance.CurrentRide.PickUpAirlinesId = string.Empty; Facade.Instance.CurrentRide.PickUpAirlines = string.Empty; } if (direction == 2) { Facade.Instance.CurrentRide.DropOffAirlinesId = string.Empty; Facade.Instance.CurrentRide.DropOffAirlines = string.Empty; } model.PickerChanged += (sender, e) => { switch (direction) { case 1: Facade.Instance.CurrentRide.PickUpAirlinesId = e.SelectedKey.ToString(); Facade.Instance.CurrentRide.PickUpAirlines = e.SelectedValue.ToString(); break; case 2: Facade.Instance.CurrentRide.DropOffAirlinesId = e.SelectedKey.ToString(); Facade.Instance.CurrentRide.DropOffAirlines = e.SelectedValue.ToString(); break; default: throw new NotImplementedException(); } field.Text = e.SelectedValue; field.SendActionForControlEvents(UIControlEvent.ValueChanged); }; UIPickerView picker = new UIPickerView(); picker.ShowSelectionIndicator = true; picker.Model = model; picker.BackgroundColor = new UIColor((nfloat)(19.0 / 255.0), (nfloat)(36.0 / 255.0), (nfloat)(65.0 / 255.0), (nfloat)1.0); // Setup the toolbar UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Black; toolbar.Translucent = true; toolbar.SizeToFit(); // Create a 'done' button for the toolbar and add it to the toolbar UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { //Default selection if nothing was selected if (direction == 1 && String.IsNullOrEmpty(Facade.Instance.CurrentRide.PickUpAirlinesId) && list.Count > 0) { Facade.Instance.CurrentRide.PickUpAirlinesId = list [0].Key.ToString(); Facade.Instance.CurrentRide.PickUpAirlines = list [0].Value.ToString(); field.Text = list [0].Value; } if (direction == 2 && String.IsNullOrEmpty(Facade.Instance.CurrentRide.DropOffAirlinesId) && list.Count > 0) { Facade.Instance.CurrentRide.DropOffAirlinesId = list [0].Key.ToString(); Facade.Instance.CurrentRide.DropOffAirlines = list [0].Value.ToString(); field.Text = list [0].Value; } field.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true); field.InputView = picker; field.InputAccessoryView = toolbar; field.ShouldChangeCharacters = new UITextFieldChange(delegate(UITextField textField, NSRange range, string replacementString) { return(false); }); }
/// <summary> /// Add toolbar with Done button /// </summary> protected void AddDoneButton() { var toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)); // var doneButton = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate { // this.Control.ResignFirstResponder (); // }); var doneButton = new UIBarButtonItem(HACCPUtil.GetResourceString("Done"), UIBarButtonItemStyle.Plain, delegate { Control.ResignFirstResponder(); }); var haccpEntry = Element as HACCPEntry; if (haccpEntry != null && (Element != null && haccpEntry.ShowPlusMinus)) { var decimalChar = Convert.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); var plussMinusButton = new UIBarButtonItem(" +/- ", UIBarButtonItemStyle.Plain, delegate { if (!string.IsNullOrEmpty(Element.Text) && Element.Text != decimalChar) { double val; if (double.TryParse(Element.Text, out val)) { if (val != 0) { if (!Element.Text.Contains("-")) { Element.Text = "-" + Element.Text; } else if (Element.Text.Contains("-")) { Element.Text = Element.Text.Replace("-", ""); } } } } }); if (UIScreen.MainScreen.Bounds.Width > 500.0) { toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), plussMinusButton }; } else { var space = (float)(UIScreen.MainScreen.Bounds.Width - 140); toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), plussMinusButton, new UIBarButtonItem(new UIView(new RectangleF(0.0f, 0.0f, space, 44.0f))), doneButton }; } plussMinusButton.TintColor = doneButton.TintColor = UIColor.Black; } else { toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneButton }; doneButton.TintColor = UIColor.Black; } Control.InputAccessoryView = toolbar; }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _toolbar = new UIToolbar(); _toolbar.TranslatesAutoresizingMaskIntoConstraints = false; _stopsOrBarriersPicker = new UISegmentedControl("Stops", "Barriers"); _resetButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh); _statusLabel = new UILabel { Text = "Instructions", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _settingsButton = new UIBarButtonItem(UIImage.FromBundle("Settings"), UIBarButtonItemStyle.Plain, null); _routeButton = new UIBarButtonItem("Route", UIBarButtonItemStyle.Plain, null); _directionsButton = new UIBarButtonItem(UIImage.FromBundle("DirectionsList"), UIBarButtonItemStyle.Plain, null); _activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { TranslatesAutoresizingMaskIntoConstraints = false, HidesWhenStopped = true, BackgroundColor = UIColor.FromWhiteAlpha(0, .5f) }; _toolbar.Items = new[] { new UIBarButtonItem(_stopsOrBarriersPicker), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _resetButton, _settingsButton, _routeButton, _directionsButton }; // Add the views. View.AddSubviews(_myMapView, _statusLabel, _toolbar, _activityIndicator); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor), _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _statusLabel.HeightAnchor.ConstraintEqualTo(40), _activityIndicator.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor), _activityIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _activityIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _activityIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) } ); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView() { TranslatesAutoresizingMaskIntoConstraints = false }; _navigateButton = new UIBarButtonItem() { Title = "Navigate", Enabled = false }; _recenterButton = new UIBarButtonItem() { Title = "Recenter", Enabled = false }; _toolbar = new UIToolbar() { TranslatesAutoresizingMaskIntoConstraints = false }; _toolbar.Items = new[] { _navigateButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _recenterButton }; _statusLabel = new UILabel { Text = "", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Left, BackgroundColor = UIColor.White, TextColor = UIColor.White, LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, _toolbar, _statusLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor), _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), }); }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UIToolbar toolbar = new UIToolbar { TranslatesAutoresizingMaskIntoConstraints = false }; _connectivityImage = new UIImageView(new CoreGraphics.CGRect(0, 0, 25, 25)); _attachmentImage = new UIImageView(new CoreGraphics.CGRect(0, 0, 25, 25)); UILabel connectivityLabel = new UILabel() { Text = "Connectivity" }; UILabel attachmentLabel = new UILabel() { Text = "Attachment" }; toolbar.Items = new[] { new UIBarButtonItem { CustomView = _attachmentImage }, new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 8 }, new UIBarButtonItem { CustomView = attachmentLabel }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem { CustomView = _connectivityImage }, new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 8 }, new UIBarButtonItem { CustomView = connectivityLabel }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), }; // Add the views. View.AddSubviews(_myMapView, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.TopAnchor.ConstraintEqualTo(_myMapView.BottomAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor) }); }
protected override void OnElementChanged(ElementChangedEventArgs <Picker> e) { if (e.OldElement != null) { ((INotifyCollectionChanged)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged; } if (e.NewElement != null) { if (Control == null) { // disabled cut, delete, and toggle actions because they can throw an unhandled native exception var entry = CreateNativeControl(); entry.EditingDidBegin += OnStarted; entry.EditingDidEnd += OnEnded; entry.EditingChanged += OnEditing; _picker = new UIPickerView(); var width = UIScreen.MainScreen.Bounds.Width; var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44)) { BarStyle = UIBarStyle.Default, Translucent = true }; var spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) => { var s = (PickerSource)_picker.Model; if (s.SelectedIndex == -1 && Element.Items != null && Element.Items.Count > 0) { UpdatePickerSelectedIndex(0); } UpdatePickerFromModel(s); entry.ResignFirstResponder(); UpdateCharacterSpacing(); }); toolbar.SetItems(new[] { spacer, doneButton }, false); entry.InputView = _picker; entry.InputAccessoryView = toolbar; entry.InputView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; entry.InputAccessoryView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; entry.InputAssistantItem.LeadingBarButtonGroups = null; entry.InputAssistantItem.TrailingBarButtonGroups = null; _defaultTextColor = entry.TextColor; _useLegacyColorManagement = e.NewElement.UseLegacyColorManagement(); entry.AccessibilityTraits = UIAccessibilityTrait.Button; SetNativeControl(entry); } _picker.Model = new PickerSource(this); UpdateFont(); UpdatePicker(); UpdateTextColor(); UpdateHorizontalTextAlignment(); UpdateVerticalTextAlignment(); ((INotifyCollectionChanged)e.NewElement.Items).CollectionChanged += RowsCollectionChanged; } base.OnElementChanged(e); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create a new MapView control and provide its location coordinates on the frame _myMapView = new MapView(); // Create a new Map instance with the basemap Map myMap = new Map(SpatialReferences.WebMercator); // Create a new ArcGISVectorTiledLayer with the navigation serice Url _vectorTiledLayer = new ArcGISVectorTiledLayer(new Uri(_navigationUrl)); myMap.Basemap = new Basemap(_vectorTiledLayer); // Assign the Map to the MapView _myMapView.Map = myMap; // Create a segmented control to display buttons UISegmentedControl segmentControl = new UISegmentedControl(); segmentControl.Frame = new CoreGraphics.CGRect(10, 8, View.Bounds.Width - 20, 24); segmentControl.InsertSegment("Dark gray", 0, false); segmentControl.InsertSegment("Streets", 1, false); segmentControl.InsertSegment("Night", 2, false); segmentControl.InsertSegment("Navigation", 3, false); segmentControl.SelectedSegment = 0; segmentControl.ValueChanged += (sender, e) => { var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment; switch (selectedSegmentId) { case 0: _vectorTiledLayerUrl = _darkGrayUrl; break; case 1: _vectorTiledLayerUrl = _streetUrl; break; case 2: _vectorTiledLayerUrl = _nightUrl; break; case 3: _vectorTiledLayerUrl = _navigationUrl; break; } // Create a new ArcGISVectorTiledLayer with the Url Selected by the user _vectorTiledLayer = new ArcGISVectorTiledLayer(new Uri(_vectorTiledLayerUrl)); // Create new Map with basemap and assigning to the Mapviews Map _myMapView.Map = new Map(new Basemap(_vectorTiledLayer)); }; // Create a UIBarButtonItem where its view is the SegmentControl UIBarButtonItem barButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); barButtonItem.CustomView = segmentControl; // Create a toolbar on the bottom of the display _toolbar = new UIToolbar(); _toolbar.AutosizesSubviews = true; // Add the bar button item to an array of UIBarButtonItems UIBarButtonItem[] barButtonItems = new UIBarButtonItem[] { barButtonItem }; // Add the UIBarButtonItems array to the toolbar _toolbar.SetItems(barButtonItems, true); View.AddSubviews(_myMapView, _toolbar); }
public void UpdateCell(Listing list, UITableView tableView, List <UIButton> rightsBtns, UIView leftView, NSIndexPath indexPath) { ContentView.RemoveAllSubViews(); desc = new UILabel(); price = new UILabel(); make = new UILabel(); mileage = new UILabel(); source = new UILabel(); item = list; //tool = GetToolBar (); //if not visible remove info if (tableView.IndexPathsForVisibleRows.ToList().Select(x => x.Equals(indexPath)) == null) { ImageView.Image = null; } //check if visible if (tableView.IndexPathsForVisibleRows.ToList().Select(x => x.Equals(indexPath)) != null) { this.DownloadImageAsync(list.images[0]).ContinueWith((task) => InvokeOnMainThread(() => { //var cellShown = tableView.IndexPathsForVisibleRows.ToList().Select(x=>x.Equals(indexPath)); //DetailTextLabel.Text = list.description; if (!task.IsFaulted) { //ImageView.Image = null; ImageView.Image = task.Result; } if (list.@new) { circle = new CircleView(); ContentView.Add(circle); //make.Add (circle); } //desc = new UILabel(new RectangleF(0, ImageView.Frame.Bottom + 60, ContentView.Bounds.Size.Width -10, 100)); desc.TextAlignment = UITextAlignment.Center; desc.LineBreakMode = UILineBreakMode.TailTruncation; desc.Font = UIFont.PreferredCaption1; desc.Lines = 0; desc.Text = string.Empty; desc.Text = list.descriptionCollapsed; //price = new UILabel(new RectangleF(0, ImageView.Frame.Bottom, ContentView.Bounds.Size.Width, 20)); price.LineBreakMode = UILineBreakMode.WordWrap; price.Font = UIFont.PreferredBody; price.Lines = 0; price.TextAlignment = UITextAlignment.Right; price.Text = string.Empty; price.Text = string.Format("$ {0}", list.price.ToString()); //make = new UILabel(new RectangleF( 0 , ImageView.Frame.Bottom, ContentView.Bounds.Size.Width, 20)); make.LineBreakMode = UILineBreakMode.TailTruncation; make.Font = UIFont.PreferredBody; make.Lines = 1; make.TextAlignment = UITextAlignment.Left; make.Text = string.Empty; make.Text = list.title; //mileage = new UILabel(new RectangleF( 0 , make.Frame.Bottom, ContentView.Bounds.Size.Width, 20)); mileage.Font = UIFont.PreferredSubheadline; mileage.Lines = 1; mileage.TextAlignment = UITextAlignment.Left; mileage.Text = string.Empty; mileage.Text = string.Format("Mileage : {0} mi", list.mileage.ToString()); //source = new UILabel(new RectangleF( 0 , mileage.Frame.Bottom, ContentView.Bounds.Size.Width, 20)); source.Font = UIFont.PreferredBody; source.Lines = 1; source.TextAlignment = UITextAlignment.Left; source.Text = string.Empty; source.Text = string.Format("Source : {0}", list.source); tool = GetToolBar(); if (tableView.IndexPathsForVisibleRows.ToList().Select(x => x.Equals(indexPath)) != null && indexPath != null) { //tableView.ReloadRows (new NSIndexPath[] { indexPath },UITableViewRowAnimation.Left); } })); } }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView() { TranslatesAutoresizingMaskIntoConstraints = false }; var switchToolbar = new UIToolbar() { TranslatesAutoresizingMaskIntoConstraints = false }; var buttonToolbar = new UIToolbar() { TranslatesAutoresizingMaskIntoConstraints = false }; var switchLabel = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false }; switchLabel.Text = "Include isolated features"; _featuresSwitch = new UISwitch() { TranslatesAutoresizingMaskIntoConstraints = false }; switchToolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem() { CustomView = switchLabel }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem() { CustomView = _featuresSwitch } }; _categoryButton = new UIBarButtonItem() { Title = "Filter Barrier Category" }; _traceButton = new UIBarButtonItem() { Title = "Trace" }; buttonToolbar.Items = new UIBarButtonItem[] { _categoryButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _traceButton }; _loadingView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { BackgroundColor = UIColor.FromWhiteAlpha(0, .5f), HidesWhenStopped = true, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, switchToolbar, buttonToolbar, _loadingView); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(switchToolbar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), switchToolbar.TopAnchor.ConstraintEqualTo(_myMapView.BottomAnchor), switchToolbar.BottomAnchor.ConstraintEqualTo(buttonToolbar.TopAnchor), switchToolbar.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), switchToolbar.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), buttonToolbar.TopAnchor.ConstraintEqualTo(switchToolbar.BottomAnchor), buttonToolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), buttonToolbar.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), buttonToolbar.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), _loadingView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _loadingView.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _loadingView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), _loadingView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), }); }
private void SetCustomToolbar(string doneButtonText, string cancelButtonText, string titleText) { UIToolbar toolbar = new UIToolbar { BarStyle = UIBarStyle.Default, Translucent = true, BackgroundColor = Color.FromHex("#252D3C").ToUIColor(), BarTintColor = Color.FromHex("#252D3C").ToUIColor() }; toolbar.SizeToFit(); UIBarButtonItem cancelButton = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Plain, (sender, e) => { Control.ResignFirstResponder(); }); cancelButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Normal); cancelButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Selected); UIBarButtonItem flexible = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); UILabel titleView = new UILabel(new CoreGraphics.CGRect(0, 0, 200, 50)) { Text = titleText, TextAlignment = UITextAlignment.Center, TextColor = UIColor.White }; UIBarButtonItem title = new UIBarButtonItem(titleView); titleView.Font = UIFont.BoldSystemFontOfSize(16); title.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); title.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Selected); UIBarButtonItem doneButton = new UIBarButtonItem(doneButtonText, UIBarButtonItemStyle.Done, (s, ev) => { if (this.element != null) { doneActivated = true; this.element.SelectedIndex = (int)(Control.InputView as UIPickerView).SelectedRowInComponent(0); if (this.element.SelectedIndex >= 0) { this.element.SelectedItem = this.element.ItemsSource[this.element.SelectedIndex]; Control.ResignFirstResponder(); Control.TextColor = Color.FromHex("#2E2E2E").ToUIColor(); //this.element.Command.Execute(this.element.SelectedItem as UiControl); } else { Control.ResignFirstResponder(); } } }); doneButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Normal); doneButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Selected); toolbar.SetItems(new UIBarButtonItem[] { cancelButton, flexible, title, flexible, doneButton }, true); Control.InputAccessoryView = toolbar; }
public override void ViewDidLoad() { NavigationItem.Title = "Registration"; NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null); HideKeyboardGesture = new UITapGestureRecognizer(() => { View.EndEditing(true); }); var finishButton = new UIBarButtonItem("Finish", UIBarButtonItemStyle.Plain, async(sender, args) => { if (Reachability.IsHostReachable(Settings._baseDomain)) { LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame, "Loading ..."); this.View.AddSubview(loadingIndicator); //Attempt to register in the API var response = await MagAppRegisterResponse.RegisterAsync(); if (response.Status == "Success") { loadingIndicator.Hide(); Settings.IsRegistered = true; //var registrationStoryboard = UIStoryboard.FromName("Main_ipad", NSBundle.MainBundle); //PushNotificationPromptViewController pushNotificationPromptViewController = (PushNotificationPromptViewController)registrationStoryboard.InstantiateViewController("PushNotificationPromptViewController"); //pushNotificationPromptViewController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext; //PresentViewController(pushNotificationPromptViewController, true, () => //{ var alert = UIAlertController.Create("Congratulations!", "You have successfully registered.", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) => { this.DismissViewController(true, null); var loginViewController = this.PresentingViewController as LoginViewController; this.NavigationController.DismissViewController(true, null); if (loginViewController != null) { loginViewController.PerformSegue("LoadTabBarControllerSeque", loginViewController); } })); PresentViewController(alert, animated: true, completionHandler: () => { }); //}); } else { loadingIndicator.Hide(); HelperMethods.SendBasicAlert("Oops.", response.ResponseMsg); } } else { HelperMethods.SendBasicAlert("Please connect to the internet", "Internet access is required."); } }); UITextAttributes icoFontAttribute = new UITextAttributes(); icoFontAttribute.Font = UIFont.BoldSystemFontOfSize(20); icoFontAttribute.TextColor = UIColor.White; finishButton.SetTitleTextAttributes(icoFontAttribute, UIControlState.Normal); this.NavigationItem.SetRightBarButtonItem(finishButton, true); var orderByPicker = new UIPickerView(); orderByPicker.Model = new SortOptionsViewModel(); orderByPicker.ShowSelectionIndicator = true; UIToolbar orderByToolbar = new UIToolbar(); orderByToolbar.BarStyle = UIBarStyle.Black; orderByToolbar.Translucent = true; orderByToolbar.SizeToFit(); UIBarButtonItem orderByDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { UITextField textview = OrderByTextField; textview.Text = Settings.SortOptions; textview.ResignFirstResponder(); }); orderByToolbar.SetItems(new UIBarButtonItem[] { orderByDoneButton }, true); OrderByTextField.InputView = orderByPicker; OrderByTextField.InputAccessoryView = orderByToolbar; var timeframePicker = new UIPickerView(); timeframePicker.Model = new TimeframeViewModel(); timeframePicker.ShowSelectionIndicator = true; UIToolbar timeframeToolbar = new UIToolbar(); timeframeToolbar.BarStyle = UIBarStyle.Black; timeframeToolbar.Translucent = true; timeframeToolbar.SizeToFit(); UIBarButtonItem timeframeDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { UITextField textview = TimeFrameTextField; textview.Text = Settings.PurchaseTimeFrame + " months"; textview.ResignFirstResponder(); }); timeframeToolbar.SetItems(new UIBarButtonItem[] { timeframeDoneButton }, true); TimeFrameTextField.InputView = timeframePicker; TimeFrameTextField.InputAccessoryView = timeframeToolbar; var whyFlyPicker = new UIPickerView(); whyFlyPicker.Model = new PurposeViewModel(); whyFlyPicker.ShowSelectionIndicator = true; UIToolbar whyFlyToolbar = new UIToolbar(); whyFlyToolbar.BarStyle = UIBarStyle.Black; whyFlyToolbar.Translucent = true; whyFlyToolbar.SizeToFit(); UIBarButtonItem whyFlyDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { UITextField textview = WhyFlyTextField; //var selected = Settings.LocationResponse.PurposeForFlying.FirstOrDefault(row => row.FlyingPurposeId == Settings.PurposeId); textview.Text = Settings.PurposeString; textview.ResignFirstResponder(); }); whyFlyToolbar.SetItems(new UIBarButtonItem[] { whyFlyDoneButton }, true); WhyFlyTextField.InputView = whyFlyPicker; WhyFlyTextField.InputAccessoryView = whyFlyToolbar; var borderFrameHeight = WhyFlyTextField.Frame.Size.Height - 1; var borderFrameWidth = this.View.Bounds.Width - 20; var borderBackgroundColor = UIColor.Gray.CGColor; // create CALayer var bottomBorder1 = new CALayer(); bottomBorder1.Frame = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f); bottomBorder1.BackgroundColor = borderBackgroundColor; var bottomBorder2 = new CALayer(); bottomBorder2.Frame = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f); bottomBorder2.BackgroundColor = borderBackgroundColor; var bottomBorder3 = new CALayer(); bottomBorder3.Frame = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f); bottomBorder3.BackgroundColor = borderBackgroundColor; var bottomBorder4 = new CALayer(); bottomBorder4.Frame = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f); bottomBorder4.BackgroundColor = borderBackgroundColor; var fontSize = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? 22.0f : 16.0f; var fontObject = UIFont.SystemFontOfSize(fontSize); WhyFlyTextField.Layer.AddSublayer(bottomBorder2); WhyFlyTextField.Layer.MasksToBounds = true; WhyFlyTextField.AttributedPlaceholder = new NSAttributedString( "Select from list", font: fontObject, foregroundColor: UIColor.DarkGray ); WhyFlyTextField.Font = fontObject; WhyFlyTextField.Text = Settings.PurposeString ?? string.Empty; TimeFrameTextField.Layer.AddSublayer(bottomBorder3); TimeFrameTextField.Layer.MasksToBounds = true; TimeFrameTextField.AttributedPlaceholder = new NSAttributedString( "Select from list", font: fontObject, foregroundColor: UIColor.DarkGray ); TimeFrameTextField.Font = fontObject; TimeFrameTextField.Text = Settings.PurchaseTimeFrame != 0 ? Settings.PurchaseTimeFrame + " months" : string.Empty; OrderByTextField.Layer.AddSublayer(bottomBorder4); OrderByTextField.Layer.MasksToBounds = true; OrderByTextField.AttributedPlaceholder = new NSAttributedString( "Select from list", font: fontObject, foregroundColor: UIColor.DarkGray ); OrderByTextField.Font = fontObject; OrderByTextField.Text = Settings.SortOptions ?? string.Empty; // add to UITextField HoursTextView.Layer.AddSublayer(bottomBorder1); HoursTextView.Layer.MasksToBounds = true; HoursTextView.Font = fontObject; HoursTextView.KeyboardType = UIKeyboardType.NumberPad; HoursTextView.EditingDidEnd += (sender, e) => { if (HoursTextView.Text != string.Empty) { int hours = 0; if (int.TryParse(HoursTextView.Text, out hours) && hours > 0) { Settings.Hours = hours; } } }; HoursTextView.Text = Settings.Hours != 0 ? Settings.Hours.ToString() : string.Empty; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _mapView = new MapView(); _mapView.TranslatesAutoresizingMaskIntoConstraints = false; _transactionButton = new UIBarButtonItem(); _transactionButton.Title = "Start transaction"; _syncButton = new UIBarButtonItem(); _syncButton.Title = "Sync"; _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add); _addButton.Enabled = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { _transactionButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _syncButton, _addButton }; _transactionSwitch = new UISwitch(); _transactionSwitch.TranslatesAutoresizingMaskIntoConstraints = false; _transactionSwitch.On = true; _statusLabel = new UILabel { Text = "Preparing sample data...", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 2, TranslatesAutoresizingMaskIntoConstraints = false }; _statusLabel.TranslatesAutoresizingMaskIntoConstraints = false; UILabel requireTransactionsLabel = new UILabel(); requireTransactionsLabel.TranslatesAutoresizingMaskIntoConstraints = false; requireTransactionsLabel.Text = "Require transaction"; requireTransactionsLabel.TextAlignment = UITextAlignment.Right; requireTransactionsLabel.SetContentCompressionResistancePriority((float)UILayoutPriority.DefaultHigh, UILayoutConstraintAxis.Horizontal); UIStackView requireTransactionRow = new UIStackView(new UIView[] { requireTransactionsLabel, _transactionSwitch }); requireTransactionRow.TranslatesAutoresizingMaskIntoConstraints = false; requireTransactionRow.Axis = UILayoutConstraintAxis.Horizontal; requireTransactionRow.Distribution = UIStackViewDistribution.Fill; requireTransactionRow.Spacing = 8; requireTransactionRow.LayoutMarginsRelativeArrangement = true; requireTransactionRow.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8); _progressBar = new UIProgressView(UIProgressViewStyle.Bar); _progressBar.TranslatesAutoresizingMaskIntoConstraints = false; // Add the views. View.AddSubviews(_mapView, _statusLabel, requireTransactionRow, toolbar, _progressBar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _mapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _mapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _mapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _mapView.BottomAnchor.ConstraintEqualTo(requireTransactionRow.TopAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), requireTransactionRow.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), requireTransactionRow.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), requireTransactionRow.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(_mapView.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(_mapView.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(_mapView.TrailingAnchor), _statusLabel.HeightAnchor.ConstraintEqualTo(80), _progressBar.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor), _progressBar.LeadingAnchor.ConstraintEqualTo(_statusLabel.LeadingAnchor), _progressBar.TrailingAnchor.ConstraintEqualTo(_statusLabel.TrailingAnchor), _progressBar.HeightAnchor.ConstraintEqualTo(8) }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _toggleAxisOrderSwitch = new UISwitch(); UILabel axisOrderLabel = new UILabel(); axisOrderLabel.Text = "Swap coordinates"; _chooseLayersButton = new UIBarButtonItem(); _chooseLayersButton.Title = "Choose layer"; _chooseLayersButton.Enabled = false; _loadServiceButton = new UIBarButtonItem(); UIToolbar loadBar = new UIToolbar(); loadBar.TranslatesAutoresizingMaskIntoConstraints = false; loadBar.Items = new[] { _loadServiceButton }; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem(_toggleAxisOrderSwitch), new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 8 }, new UIBarButtonItem(axisOrderLabel), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _chooseLayersButton }; _loadingProgressBar = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); _loadingProgressBar.TranslatesAutoresizingMaskIntoConstraints = false; _loadingProgressBar.HidesWhenStopped = true; _loadingProgressBar.BackgroundColor = UIColor.FromWhiteAlpha(0, .6f); // Add the views. View.AddSubviews(_myMapView, loadBar, toolbar, _loadingProgressBar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(loadBar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), loadBar.TopAnchor.ConstraintEqualTo(_myMapView.BottomAnchor), loadBar.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), loadBar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), loadBar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.TopAnchor.ConstraintEqualTo(loadBar.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _loadingProgressBar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _loadingProgressBar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _loadingProgressBar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _loadingProgressBar.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }); }
protected void SetupFlightType(UITextField field, bool IsPickUp) { List <KeyValuePair <object, string> > list = new List <KeyValuePair <object, string> > (); list.Add(new KeyValuePair <object, string>(true, String.Format("Domestic"))); list.Add(new KeyValuePair <object, string>(false, String.Format("International"))); //SetupGenericSelector (field, list); if (IsPickUp == true) { Facade.Instance.CurrentRide.PickUpFlightTypeIsDomestic = null; //field.Text = list [0].Value; } if (IsPickUp == false) { Facade.Instance.CurrentRide.DropOffFlightTypeIsDomestic = null; //field.Text = list [0].Value; } MyPickerModel model = new MyPickerModel(list); model.PickerChanged += (sender, e) => { field.Text = e.SelectedValue; bool outResult; if (bool.TryParse(e.SelectedKey.ToString(), out outResult)) { if (IsPickUp) { Facade.Instance.CurrentRide.PickUpFlightTypeIsDomestic = outResult; } else { Facade.Instance.CurrentRide.DropOffFlightTypeIsDomestic = outResult; } } else { if (list.Count > 0) { field.Text = list [0].Value; if (IsPickUp) { Facade.Instance.CurrentRide.PickUpFlightTypeIsDomestic = (bool)list [0].Key; } else { Facade.Instance.CurrentRide.PickUpFlightTypeIsDomestic = (bool)list [0].Key; } } } field.SendActionForControlEvents(UIControlEvent.ValueChanged); }; UIPickerView picker = new UIPickerView(); picker.ShowSelectionIndicator = true; picker.Model = model; picker.BackgroundColor = new UIColor((nfloat)(19.0 / 255.0), (nfloat)(36.0 / 255.0), (nfloat)(65.0 / 255.0), (nfloat)1.0); // Setup the toolbar UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Black; toolbar.Translucent = true; toolbar.SizeToFit(); // Create a 'done' button for the toolbar and add it to the toolbar UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { //Default selection if nothing was selected if (IsPickUp == true && Facade.Instance.CurrentRide.PickUpFlightTypeIsDomestic == null && list.Count > 0) { Facade.Instance.CurrentRide.PickUpFlightTypeIsDomestic = (bool)list [0].Key; field.Text = list [0].Value; } if (IsPickUp == false && Facade.Instance.CurrentRide.DropOffFlightTypeIsDomestic == null && list.Count > 0) { Facade.Instance.CurrentRide.DropOffFlightTypeIsDomestic = (bool)list [0].Key; field.Text = list [0].Value; } field.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true); field.InputView = picker; field.InputAccessoryView = toolbar; field.ShouldChangeCharacters = new UITextFieldChange(delegate(UITextField textField, NSRange range, string replacementString) { return(false); }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _generateButton = new UIBarButtonItem(); _generateButton.Title = "Generate"; _generateButton.Enabled = false; _syncButton = new UIBarButtonItem(); _syncButton.Title = "Synchronize"; _syncButton.Enabled = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { _generateButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _syncButton }; _helpLabel = new UILabel { Text = "1. Tap 'Generate'.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _progressBar = new UIProgressView(); _progressBar.TranslatesAutoresizingMaskIntoConstraints = false; _progressBar.Hidden = true; // Add the views. View.AddSubviews(_myMapView, _helpLabel, _progressBar, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.HeightAnchor.ConstraintEqualTo(40), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _progressBar.TopAnchor.ConstraintEqualTo(_helpLabel.BottomAnchor), _progressBar.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), _progressBar.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), _progressBar.HeightAnchor.ConstraintEqualTo(8) }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; UIToolbar topToolbar = new UIToolbar { TranslatesAutoresizingMaskIntoConstraints = false }; _myMapView = new MapView { TranslatesAutoresizingMaskIntoConstraints = false }; _timeLabel = new UILabel(); _timeSlider = new UISlider { MinValue = 0, MaxValue = 1, TranslatesAutoresizingMaskIntoConstraints = false }; UIToolbar bottomToolbar = new UIToolbar(); bottomToolbar.TranslatesAutoresizingMaskIntoConstraints = false; bottomToolbar.Items = new[] { new UIBarButtonItem { CustomView = _timeSlider, Width = 100 }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem { CustomView = _timeLabel }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), }; UIStackView legendView = new UIStackView(); legendView.TranslatesAutoresizingMaskIntoConstraints = false; legendView.Axis = UILayoutConstraintAxis.Horizontal; legendView.Spacing = 8; UIView redIcon = new UIView(); redIcon.TranslatesAutoresizingMaskIntoConstraints = false; redIcon.BackgroundColor = UIColor.Red; redIcon.WidthAnchor.ConstraintEqualTo(16).Active = true; redIcon.HeightAnchor.ConstraintEqualTo(16).Active = true; redIcon.ClipsToBounds = true; redIcon.Layer.CornerRadius = 8; legendView.AddArrangedSubview(redIcon); UILabel _redLabel = new UILabel { Text = "Offset 10 days", TextColor = UIColor.Red, TranslatesAutoresizingMaskIntoConstraints = false }; legendView.AddArrangedSubview(_redLabel); UIView spacer = new UIView(); spacer.TranslatesAutoresizingMaskIntoConstraints = false; spacer.SetContentCompressionResistancePriority((float)UILayoutPriority.DefaultLow, UILayoutConstraintAxis.Horizontal); legendView.AddArrangedSubview(spacer); UIView blueIcon = new UIView(); blueIcon.BackgroundColor = UIColor.Blue; blueIcon.TranslatesAutoresizingMaskIntoConstraints = false; blueIcon.WidthAnchor.ConstraintEqualTo(16).Active = true; blueIcon.HeightAnchor.ConstraintEqualTo(16).Active = true; blueIcon.ClipsToBounds = true; blueIcon.Layer.CornerRadius = 8; legendView.AddArrangedSubview(blueIcon); UILabel _blueLabel = new UILabel { Text = "No offset", TextColor = UIColor.Blue, TranslatesAutoresizingMaskIntoConstraints = false }; legendView.AddArrangedSubview(_blueLabel); // Add the views. View.AddSubviews(topToolbar, _myMapView, bottomToolbar); topToolbar.AddSubview(legendView); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { topToolbar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), topToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), topToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.TopAnchor.ConstraintEqualTo(topToolbar.BottomAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(bottomToolbar.TopAnchor), bottomToolbar.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), bottomToolbar.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), bottomToolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), legendView.LeftAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.LeftAnchor, 8), legendView.RightAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.RightAnchor, -8), legendView.TopAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.TopAnchor, 8), legendView.BottomAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.BottomAnchor, -8), redIcon.CenterYAnchor.ConstraintEqualTo(blueIcon.CenterYAnchor), blueIcon.CenterYAnchor.ConstraintEqualTo(topToolbar.CenterYAnchor), _timeLabel.WidthAnchor.ConstraintEqualTo(150), _timeSlider.WidthAnchor.ConstraintEqualTo(600), }); }
public override void ViewDidLoad() { base.ViewDidLoad(); CS_Label.Text = "Computer Science" + Environment.NewLine + "Converter"; View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("ConverterBackground.png")); // Perform any additional setup after loading the view, typically from a nib. toolbar = new UIToolbar(new CoreGraphics.CGRect(new nfloat(0.0f), new nfloat(0.0f), this.View.Frame.Size.Width, new nfloat(44.0f))); toolbar.TintColor = UIColor.White; toolbar.BarStyle = UIBarStyle.Black; toolbar.Translucent = true; var myButton = new UIBarButtonItem("Hex:", UIBarButtonItemStyle.Bordered, AddTLD); toolbar.Items = new UIBarButtonItem[] { myButton, new UIBarButtonItem("A", UIBarButtonItemStyle.Plain, AddTLD), new UIBarButtonItem("B", UIBarButtonItemStyle.Plain, AddTLD), new UIBarButtonItem("C", UIBarButtonItemStyle.Plain, AddTLD), new UIBarButtonItem("D", UIBarButtonItemStyle.Plain, AddTLD), new UIBarButtonItem("E", UIBarButtonItemStyle.Plain, AddTLD), new UIBarButtonItem("F", UIBarButtonItemStyle.Plain, AddTLD), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { this.Hexadecimal_TextBox.ResignFirstResponder(); }) }; Hexadecimal_TextBox.KeyboardAppearance = UIKeyboardAppearance.Default; Hexadecimal_TextBox.InputAccessoryView = toolbar; //************************************************************** generic = new UIToolbar(new CoreGraphics.CGRect(new nfloat(0.0f), new nfloat(0.0f), this.View.Frame.Size.Width, new nfloat(44.0f))); generic.TintColor = UIColor.White; generic.BarStyle = UIBarStyle.Black; generic.Translucent = true; var myButtong = new UIBarButtonItem("String: ", UIBarButtonItemStyle.Bordered, AddNull); generic.Items = new UIBarButtonItem[] { myButtong, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { String_TextBox.ResignFirstResponder(); }) }; String_TextBox.KeyboardAppearance = UIKeyboardAppearance.Default; String_TextBox.InputAccessoryView = generic; //************************************************************** generic2 = new UIToolbar(new CoreGraphics.CGRect(new nfloat(0.0f), new nfloat(0.0f), this.View.Frame.Size.Width, new nfloat(44.0f))); generic2.TintColor = UIColor.White; generic2.BarStyle = UIBarStyle.Black; generic2.Translucent = true; var myButtong2 = new UIBarButtonItem("Decimal: ", UIBarButtonItemStyle.Bordered, AddNull); generic2.Items = new UIBarButtonItem[] { myButtong2, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { Decimal_TextBox.ResignFirstResponder(); }) }; Decimal_TextBox.KeyboardAppearance = UIKeyboardAppearance.Default; Decimal_TextBox.InputAccessoryView = generic2; //************************************************************** genericB = new UIToolbar(new CoreGraphics.CGRect(new nfloat(0.0f), new nfloat(0.0f), this.View.Frame.Size.Width, new nfloat(44.0f))); genericB.TintColor = UIColor.White; genericB.BarStyle = UIBarStyle.Black; genericB.Translucent = true; var myButtonB = new UIBarButtonItem("Binary: ", UIBarButtonItemStyle.Bordered, AddNull); genericB.Items = new UIBarButtonItem[] { myButtonB, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { Binary_TextBox.ResignFirstResponder(); }) }; Binary_TextBox.KeyboardAppearance = UIKeyboardAppearance.Default; Binary_TextBox.InputAccessoryView = genericB; }
private void SetupUserInterface() { var centerButtonX = View.Bounds.GetMidX() - 35f; var topLeftX = View.Bounds.X + 25; var topRightX = View.Bounds.Right - 65; var bottomButtonY = View.Bounds.Bottom - 150; var topButtonY = View.Bounds.Top + 15; var buttonWidth = 70; var buttonHeight = 70; var buttonX = View.Bounds.Width - 70; var buttonY = View.Bounds.Height / 3; search = new UISearchBar(); search.Frame = new CGRect(0, 0, View.Bounds.Width, 70); UIOffset offset = new UIOffset(); offset.Horizontal = 0; offset.Vertical = 10; search.SearchFieldBackgroundPositionAdjustment = offset; search.KeyboardType = UIKeyboardType.NumberPad; search.BackgroundColor = Color.FromHex(Constants.ColorPrimary).ToUIColor(); search.SearchBarStyle = UISearchBarStyle.Minimal; search.Placeholder = "Truy vấn mã sản phẩm"; search.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; search.BarTintColor = UIColor.White;//Color.FromHex(Constants.ColorSecondary).ToUIColor(); //search.color UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { search.ResignFirstResponder(); if (search.Text.Length != 0) { System.Diagnostics.Debug.WriteLine("text: " + search.Text); var newResultPage = new ResultPage(search.Text); Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(newResultPage); } }); toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneButton }; search.InputAccessoryView = toolbar; ScanButton = new UIButton(); ScanButton = UIButton.FromType(UIButtonType.Custom); System.Diagnostics.Debug.WriteLine(centerButtonX + "|" + bottomButtonY + "|" + buttonWidth + "|" + buttonHeight); ScanButton.SetImage(UIImage.FromFile("ic_scan_button_1.png"), UIControlState.Normal); ScanButton.Frame = new CGRect(buttonX, buttonY, buttonWidth, buttonHeight); tabControl = new TabController(); tabControl.View.TintColor = Color.FromHex(Constants.ColorPrimary).ToUIColor(); var napphsi = App.AppHSI.Count; Device.StartTimer(TimeSpan.FromSeconds(0.3), () => { if (App.AppHSI.Count != napphsi) { tabControl.reloaddata(); napphsi = App.AppHSI.Count; } return(true); // True = Repeat again, False = Stop the timer }); /* * var application = UIApplication.SharedApplication; * var statusBarView = application.ValueForKey(new NSString("statusBar")) as UIView; * var foregroundView = statusBarView.ValueForKey(new NSString("foregroundView")) as UIView; * * UIView dataNetworkItemView = null; * foreach (UIView subview in foregroundView.Subviews) * { * System.Diagnostics.Debug.WriteLine(subview.Class.Name+"\n"); * if ("UIStatusBarSignalStrengthItemView" == subview.Class.Name) * { * dataNetworkItemView = subview; * break; * } * } * if (null == dataNetworkItemView) * System.Diagnostics.Debug.WriteLine(" return false; //NO SERVICE"); * int bars2 = ((NSNumber)dataNetworkItemView.ValueForUndefinedKey(new NSString("signalStrengthBars"))).Int32Value; * int bars = ((NSNumber)dataNetworkItemView.ValueForKey(new NSString("signalStrengthBars"))).Int32Value; * System.Diagnostics.Debug.WriteLine("datanetwork "+ bars + " "+bars2);*/ tabControl.View.Frame = new CGRect(0, 70, View.Bounds.Width, View.Bounds.Height - 70); View.Add(tabControl.View); View.Add(search); View.AddSubview(ScanButton); }
protected override void OnElementChanged(ElementChangedEventArgs <View> e) { base.OnElementChanged(e); if (e.OldElement != null || Element == null) { return; } var element = Element as RoundedEntry; UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)) { BackgroundColor = element.InputAccessoryBackgroundColor.ToUIColor(), TintColor = UIColor.Black }; var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { if (!element.ShouldEndEditing) { element.ShouldEndEditing = true; this.Control.ResignFirstResponder(); element.ShouldEndEditing = false; } else { if (this.Control != null) { this.Control.ResignFirstResponder(); } } }); toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneButton }; if (element.IsSingleLine) { textField = new CustomTextField() { EdgeInsets = new UIEdgeInsets((System.nfloat)element.TextPadding.Top, (System.nfloat)element.TextPadding.Left, (System.nfloat)element.TextPadding.Bottom, (System.nfloat)element.TextPadding.Right), ShowCursor = true }; textField.InputAccessoryView = toolbar; SetNativeControl(textField); textField.ShouldReturn = new UITextFieldCondition(OnShouldReturn); textField.ShouldChangeCharacters = OnShouldChangeCharacters; SetReturnKeyType(element); textField.EditingChanged += (sender, ev) => { ((IElementController)Element).SetValueFromRenderer(Xamarin.Forms.Entry.TextProperty, textField.Text); }; textField.SecureTextEntry = element.IsPassword; textField.ShouldBeginEditing = t => { return(!element.IsReadOnly); }; textField.AutocorrectionType = (element.EnableAutoCorrect) ? UITextAutocorrectionType.Default : UITextAutocorrectionType.No; } else { textView = new CustomTextView { ShowCursor = true }; textView.AlwaysBounceHorizontal = false; textView.AlwaysBounceVertical = false; textView.ShowsHorizontalScrollIndicator = false; textView.ShowsVerticalScrollIndicator = false; textView.BouncesZoom = false; textView.Bounces = false; textView.ContentInset = new UIEdgeInsets(0, 0, 0, 0); textView.ContentOffset = new CoreGraphics.CGPoint(0, 0); textView.ReturnKeyType = UIReturnKeyType.Default; textView.Changed += (sender, ev) => { if (textView.Text.Length == 0) { textView.SelectedRange = new NSRange(0, 0); textView.Text = element.Placeholder; textView.TextColor = element.PlaceholderColor.ToUIColor(); textView.Tag = 0; //textView.TintColor = UIColor.Clear; //if (textView.IsFirstResponder) //{ // //textView.ResignFirstResponder(); // //textView.BecomeFirstResponder(); //} ((IElementController)Element).SetValueFromRenderer(Xamarin.Forms.Entry.TextProperty, ""); textView.SelectedRange = new NSRange(0, 0); } else { if (textView.Tag == 0) { var placeholder = element.Placeholder.Substring(1, element.Placeholder.Length - 1); //bool isPlaceholderVisible = !string.IsNullOrWhiteSpace(element.Placeholder) // && textView.Text.StartsWith(placeholder); //if (isPlaceholderVisible) { string text = textView.Text.Replace(element.Placeholder, ""); text = text.Replace(placeholder, ""); textView.TextColor = element.TextColor.ToUIColor(); textView.Tag = 1; textView.Text = text; //textView.TintColor = defaultTintColor; //if (textView.IsFirstResponder) //{ // textView.ResignFirstResponder(); // textView.BecomeFirstResponder(); //} } } ((IElementController)Element).SetValueFromRenderer(Xamarin.Forms.Entry.TextProperty, textView.Text); } //element.Text = textView.Text; }; textView.SecureTextEntry = element.IsPassword; //textView.ShouldBeginEditing = t => { return !element.IsReadOnly; }; textView.AutocorrectionType = UITextAutocorrectionType.No; textView.AutocorrectionType = UITextAutocorrectionType.No; //(element.EnableAutoCorrect) ? UITextAutocorrectionType.Default : UITextAutocorrectionType.No; if (!string.IsNullOrEmpty(element.Text)) { textView.Tag = 1; } textView.ShowCursor = element.ShowCursor; if (!element.AllowCutCopyPaste) { //TO DO disable ui text field } textView.InputAccessoryView = toolbar; SetNativeControl(textView); } SetText(element); SetTextAlignment(element); SetCornerRadius(element); SetBorder(element); SetFont(element); SetTextInputTypes(element); }
// add an annotation map.AddAnnotations (new MKPointAnnotation (){ // TODO: set the name of the location as the annotation title Title= selectedLocation, Coordinate = geoLocation, } ); // zoom in and display an area/region within 5 miles MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(5), MilesToLongitudeDegrees(5, geoLocation.Latitude)); map.Region = new MKCoordinateRegion(geoLocation, span); } // setups up the picker view private void SetupPicker() { // Setup the picker and model PickerModel model = new PickerModel(this.locationList); model.PickerChanged += (sender, e) => { // TODO: set the location to the selected value this.selectedLocation = e.SelectedValue; } ; UIPickerView picker = new UIPickerView(); picker.ShowSelectionIndicator = true; picker.Model = model; // Setup the toolbar UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; toolbar.SizeToFit(); // Create a 'done' button for the toolbar and add it to the toolbar UIBarButtonItem btnDone = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { this.txtLocation.Text = selectedLocation; this.txtLocation.ResignFirstResponder(); // TODO: Plot the location on the map here SetLocationAnnotation(); } ); toolbar.SetItems(new UIBarButtonItem[]{btnDone}, true); // Tell the textbox to use the picker for input this.txtLocation.InputView = picker; // Display the toolbar over the pickers this.txtLocation.InputAccessoryView = toolbar; } private void SetupSegmentControl() { int typesWidth=260, typesHeight=30, distanceFromBottom=100; UISegmentedControl mapTypes = new UISegmentedControl(new CGRect((View.Bounds.Width-typesWidth)/2, View.Bounds.Height-distanceFromBottom, typesWidth, typesHeight)); mapTypes.InsertSegment("Road", 0, false); mapTypes.InsertSegment("Satellite", 1, false); mapTypes.InsertSegment("Hybrid", 2, false); mapTypes.SelectedSegment = 0; // Road is the default mapTypes.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin; mapTypes.ValueChanged += (s, e) => { switch(mapTypes.SelectedSegment) { case 0: map.MapType = MKMapType.Standard; break; case 1: map.MapType = MKMapType.Satellite; break; case 2: map.MapType = MKMapType.Hybrid; break; } } ; View.AddSubview(mapTypes); } /// <summary>Converts miles to latitude degrees</summary> public double MilesToLatitudeDegrees(double miles) { double earthRadius = 3960.0; // in miles double radiansToDegrees = 180.0/Math.PI; return (miles/earthRadius) * radiansToDegrees; } /// <summary>Converts miles to longitudinal degrees at a specified latitude</summary> public double MilesToLongitudeDegrees(double miles, double atLatitude) { double earthRadius = 3960.0; // in miles double degreesToRadians = Math.PI/180.0; double radiansToDegrees = 180.0/Math.PI; // derive the earth's radius at that point in latitude double radiusAtLatitude = earthRadius * Math.Cos(atLatitude * degreesToRadians); return (miles / radiusAtLatitude) * radiansToDegrees;
protected override void OnElementChanged(ElementChangedEventArgs <DatePicker> e) { base.OnElementChanged(e); if (e.NewElement == null) { return; } if (Control == null) { var entry = CreateNativeControl(); entry.EditingDidBegin += OnStarted; entry.EditingDidEnd += OnEnded; _picker = new UIDatePicker { Mode = UIDatePickerMode.Date, TimeZone = new NSTimeZone("UTC") }; if (Forms.IsiOS14OrNewer) { _picker.PreferredDatePickerStyle = UIKit.UIDatePickerStyle.Wheels; } _picker.ValueChanged += HandleValueChanged; var width = UIScreen.MainScreen.Bounds.Width; var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44)) { BarStyle = UIBarStyle.Default, Translucent = true }; var spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) => { UpdateElementDate(); entry.ResignFirstResponder(); }); toolbar.SetItems(new[] { spacer, doneButton }, false); entry.InputView = _picker; entry.InputAccessoryView = toolbar; entry.InputView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; entry.InputAccessoryView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; entry.InputAssistantItem.LeadingBarButtonGroups = null; entry.InputAssistantItem.TrailingBarButtonGroups = null; _defaultTextColor = entry.TextColor; _useLegacyColorManagement = e.NewElement.UseLegacyColorManagement(); entry.AccessibilityTraits = UIAccessibilityTrait.Button; SetNativeControl(entry); } UpdateDateFromModel(false); UpdateFont(); UpdateMaximumDate(); UpdateMinimumDate(); UpdateTextColor(); UpdateCharacterSpacing(); UpdateFlowDirection(); }
private void SetupPicker() { var model = new PckOperadoresModel(_operadores); model.ValueChanged += (sender, e) => { _seleccionado = model.SelectedValue; }; UIPickerView picker = new UIPickerView(); picker.ShowSelectionIndicator = true; picker.Model = model; UIToolbar toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; var labelTitulo = new UILabel(new CGRect(x: 0, y: 50, width: 150, height: 20)) { BackgroundColor = UIColor.Clear, TextColor = UIColor.Gray.ColorWithAlpha(0.5f), TextAlignment = UITextAlignment.Center, Text = " Lista Operadores " }; var tituloCajaTexto = new UIBarButtonItem(labelTitulo); var cancelarBoton = new UIBarButtonItem("Cancelar", UIBarButtonItemStyle.Done, (s, e) => { txtOperador.ResignFirstResponder(); }); var espacioEntreBoton = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null, null); UIBarButtonItem hechoBoton = new UIBarButtonItem("Hecho", UIBarButtonItemStyle.Done, (s, e) => { txtOperador.Text = _seleccionado; txtOperador.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[] { cancelarBoton, espacioEntreBoton, tituloCajaTexto, espacioEntreBoton, hechoBoton }, true); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; picker.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.SizeToFit(); txtOperador.InputView = picker; txtOperador.InputAccessoryView = toolbar; hechoBoton.Clicked += delegate { int posicion; if (_seleccionado == PckOperadoresModel.TituloTodosOperadores) { posicion = -1; } else { posicion = _operadores.FindIndex(o => o.Nombre == _seleccionado); } //var posicion = ((PckOperadoresModel)PckOperadores.Model).SelectedIndex; FiltrarViajesOperador(posicion); }; }
UIToolbar GetToolBar() { UITextAttributes attr = new UITextAttributes(); string local = "Location Not Available"; string datesOn = "Unknown List Date"; string pricesAbove = "Price Above Edmunds"; tool = new UIToolbar(new RectangleF(0, ContentView.Frame.Height - 35, ContentView.Frame.Width, 35)); //tool.Translucent = true; tool.Layer.BorderColor = UIColor.White.CGColor; tool.BarTintColor = UIColor.White; tool.ClipsToBounds = true; attr.Font = UIFont.SystemFontOfSize(9); attr.TextColor = UIColor.LightGray; //add location and change font color if (item.address.city != null) { local = string.Format("{0},{1}", item.address.city, item.address.state); attr.TextColor = UIColor.Blue; } var location = new UIBarButtonItem(local, UIBarButtonItemStyle.Plain, (s, e) => { //for event }); location.SetTitleTextAttributes(attr, UIControlState.Normal); if (item.created != null || item.updated != null) { datesOn = string.Format("Listed {0} days ago", CalculateDateDiff()); attr.TextColor = UIColor.LightGray; } else if (item.deleted) { datesOn = "Listing Removed"; attr.TextColor = UIColor.Red; } var timeSpan = new UIBarButtonItem(datesOn, UIBarButtonItemStyle.Plain, (s, e) => { //for event }); timeSpan.SetTitleTextAttributes(attr, UIControlState.Normal); var price = new UIBarButtonItem(pricesAbove, UIBarButtonItemStyle.Plain, delegate { if (item.pricing != null) { app.ShowPriceEdmunds(item.pricing); } }); if (item.pricing != null) { attr.TextColor = UIColor.Blue; } price.SetTitleTextAttributes(attr, UIControlState.Normal); price.Tag = 22; var bbs = new UIBarButtonItem[] { location, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), timeSpan, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), price }; tool.SetItems(bbs, true); return(tool); }
private void loadpop(NSObject sender) { int items = 0; try { items = dataPos.shareoptions.Count; } catch { items = 0; } if (items == 0) { return; } shareList = new string[items]; items = 0; foreach (shareOptions s in dataPos.shareoptions) { shareList [items] = s.key; items++; } /* * shareList[0]= "FaceBook"; * shareList[1]= "Twitter"; * shareList[2]= "Email"; */ if (showComboTaks) { return; } cmbShare _pickerDataModel; _pickerDataModel = new cmbShare(this, shareList); BarraShare = BarraShareGet(); pkrShare = new UIPickerView(new RectangleF(0, 200, 320, 216)); pkrShare.Source = _pickerDataModel; pkrShare.ShowSelectionIndicator = true; UIViewController vistaMain = new UIViewController(); vistaMain.View.Frame = new RectangleF(0, 0, 320, 240); BarraShare.Frame = new RectangleF(0, 0, 320, 40); pkrShare.Frame = new RectangleF(0, 40, 320, 216); vistaMain.View.AddSubview(BarraShare); vistaMain.View.AddSubview(pkrShare); popviewNavigate = new UINavigationController(vistaMain); detailparameters = new UIPopoverController(popviewNavigate); detailparameters.SetPopoverContentSize(new SizeF(320, 240), true); detailparameters.DidDismiss += delegate { LastTappedButton = null; detailparameters = null; }; UIButton tappedButton = (UIButton)sender; // this is for present the pop View detailparameters.PresentFromRect(tappedButton.Frame, View, UIPopoverArrowDirection.Any, true); LastTappedButton = tappedButton; }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = ApplicationTheme.BackgroundColor }; _mapView = new MapView(); _mapView.TranslatesAutoresizingMaskIntoConstraints = false; _helpLabel = new UILabel(); _helpLabel.TranslatesAutoresizingMaskIntoConstraints = false; _helpLabel.TextAlignment = UITextAlignment.Center; _helpLabel.TextColor = UIColor.White; _helpLabel.BackgroundColor = UIColor.FromWhiteAlpha(0f, 0.6f); _helpLabel.Text = "Preparing services..."; UIToolbar elevToolbar = new UIToolbar(); elevToolbar.TranslatesAutoresizingMaskIntoConstraints = false; UIBarButtonItem elevLabel = new UIBarButtonItem() { CustomView = new UILabel() { Text = "Elevation:" } }; _elevationSlider = new UISlider() { MinValue = -10, MaxValue = 10, Value = 0 }; _elevationSliderButton = new UIBarButtonItem() { CustomView = _elevationSlider }; elevToolbar.Items = new[] { elevLabel, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _elevationSliderButton }; UIToolbar buttonToolbar = new UIToolbar(); buttonToolbar.TranslatesAutoresizingMaskIntoConstraints = false; _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, AddSketch) { Enabled = false }; _undoButton = new UIBarButtonItem(UIBarButtonSystemItem.Undo, UndoButton_Clicked) { Enabled = false }; _redoButton = new UIBarButtonItem(UIBarButtonSystemItem.Redo, RedoButton_Clicked) { Enabled = false }; _doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, DoneButton_Clicked) { Enabled = false }; _viewButton = new UIBarButtonItem(UIBarButtonSystemItem.Camera, ViewButton_Clicked) { Enabled = false }; buttonToolbar.Items = new[] { _addButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _undoButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _redoButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _doneButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _viewButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; // Add the views. View.AddSubviews(_mapView, _helpLabel, elevToolbar, buttonToolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _mapView.TopAnchor.ConstraintEqualTo(View.TopAnchor), _mapView.BottomAnchor.ConstraintEqualTo(elevToolbar.TopAnchor), _mapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _mapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.HeightAnchor.ConstraintEqualTo(40), elevToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), elevToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), elevToolbar.BottomAnchor.ConstraintEqualTo(buttonToolbar.TopAnchor), buttonToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), buttonToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), buttonToolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor) }); }