protected virtual UIView createBottomToolbar() { var bottomBarFrame = getRootViewFrameRect(); bottomBarFrame.Y += bottomBarFrame.Height - DefaultToolbarHeight; bottomBarFrame.Height = DefaultToolbarHeight; var bottomBar = new UIToolbar(bottomBarFrame); bottomBar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default); bottomBar.SetShadowImage(new UIImage(), UIToolbarPosition.Any); bottomBar.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth; createToolbarButton(bottomBar, DocumentActionTypes.NavigateToFirstPage, "navigateToFirst.png", openFirstPage); createToolbarButton(bottomBar, DocumentActionTypes.NavigateToPriorPage, "navigateToPrior.png", openPriorPage); createToolbarButton(bottomBar, DocumentActionTypes.NavigateToPage, "navigateToPage.png", () => { var vc = new GotoPageVC(p => OpenDocumentPage((int)p)); vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet; PresentViewController(vc, true, null); }); createToolbarButton(bottomBar, DocumentActionTypes.NavigateToNextPage, "navigateToNext.png", openNextPage); createToolbarButton(bottomBar, DocumentActionTypes.NavigateToLastPage, "navigateToLast.png", openLastPage); createToolbarSeparator(bottomBar); var pageNumberLeft = bottomBarFrame.Width - PageNumberWidth - DefaultMargin; var pageNumberLabelFrame = new CGRect(pageNumberLeft, (bottomBarFrame.Height - PageNumberHeight) / 2, PageNumberWidth, PageNumberHeight); _pageNumberLabel = new UILabel(pageNumberLabelFrame); _pageNumberLabel.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin; _pageNumberLabel.Font = UIFont.SystemFontOfSize(12.0f); _pageNumberLabel.TextAlignment = UITextAlignment.Center; _pageNumberLabel.TextColor = UIColor.Gray; bottomBar.AddSubview(_pageNumberLabel); var sliderWidth = pageNumberLeft - SliderLeft - DefaultMargin; var sliderFrame = new CGRect(SliderLeft, (bottomBarFrame.Height - SliderHeight) / 2, sliderWidth, SliderHeight); _slider = new UISlider(sliderFrame); _slider.MinValue = 1; _slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _slider.ValueChanged += delegate { if (_pageNumberLabel != null) { _pageNumberLabel.Text = string.Format(@"{0}/{1}", (int)_slider.Value, PDFDocument.PageCount); } }; _slider.TouchUpInside += delegate(object sender, EventArgs e) { OpenDocumentPage((int)_slider.Value); }; bottomBar.AddSubview(_slider); return(bottomBar); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create toolbar, title label and buttons 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 = "Bookmarks".t(); var btnAddBookmark = new UIButton(new RectangleF(5, 5, 30, 30)); btnAddBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkAdd32.png"), UIControlState.Normal); btnAddBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIButton(new RectangleF(43, 5, 30, 30)); btnDeleteBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkDelete32.png"), UIControlState.Normal); btnDeleteBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Delete); }; toolBar.AddSubview(toolBarTitle); toolBar.AddSubview(btnAddBookmark); toolBar.AddSubview(btnDeleteBookmark); View.AddSubview(toolBar); // Create bookmarks table _BookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); _BookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _BookmarksTable.RowHeight = 55; _BookmarksTable.Source = new DataSource(this); View.AddSubview(_BookmarksTable); // Create bookmark cell and text field _NewBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); _NewBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; _NewBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); _NewBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); _NewBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _NewBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; _NewBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); _NewBookmarkCell.AddSubview(_NewBookmarkNameTxt); }
/// <summary> /// Calls when view are loaded /// </summary> 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 = "Go...".t(); var btnNavigate = new UIButton(new RectangleF(5, 5, 30, 30)); btnNavigate.SetImage(UIImage.FromFile("Images/Toolbar/NavigateToPage32.png"), UIControlState.Normal); btnNavigate.TouchUpInside += delegate { int pageNumber; int.TryParse(_PageNumberTxt.Text, out pageNumber); if ((pageNumber <= 0) || (pageNumber > PDFDocument.PageCount)) { using (var alert = new UIAlertView("Error".t(), "Invalid page number".t(), null, "Ok")) { alert.Show(); } } else { CallbackAction(pageNumber); } _PopoverController.Dismiss(true); }; toolBar.AddSubview(toolBarTitle); toolBar.AddSubview(btnNavigate); View.AddSubview(toolBar); // Create PageNumber text field _PageNumberTxt = new UITextField(new RectangleF(20, 58, View.Bounds.Width - 40, 31)); _PageNumberTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _PageNumberTxt.BorderStyle = UITextBorderStyle.RoundedRect; _PageNumberTxt.KeyboardType = UIKeyboardType.NumberPad; _PageNumberTxt.Font = UIFont.SystemFontOfSize(17.0f); _PageNumberTxt.Text = PDFDocument.CurrentPageNumber.ToString(); View.AddSubview(_PageNumberTxt); }
private void CreateLayout() { // Add the controls to the view. View.AddSubviews(_myMapView, _toolbar); // Add the help label to the toolbar. _toolbar.AddSubview(_helpLabel); }
private void CreateLayout() { // Create the webview for showing the identify result. _webView = new WKWebView(new CGRect(), new WKWebViewConfiguration()); // Add the controls to the view. View.AddSubviews(_myMapView, _webView, _toolbar); // Add the help label to the toolbar. _toolbar.AddSubview(_helpLabel); }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnAddBookmark = new UIBarButtonItem(); btnAddBookmark.Image = UIImage.FromFile("add.png"); btnAddBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIBarButtonItem(); btnDeleteBookmark.Image = UIImage.FromFile("delete.png"); btnDeleteBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Delete); }; var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Bookmarks".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnAddBookmark, btnDeleteBookmark, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _bookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); _bookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; _bookmarksTable.Source = new DataSource(this); View.AddSubview(_bookmarksTable); _newBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); _newBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; _newBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); _newBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); _newBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _newBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; _newBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); _newBookmarkCell.AddSubview(_newBookmarkNameTxt); }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnApply = new UIBarButtonItem(); btnApply.Image = UIImage.FromFile("apply.png"); btnApply.Clicked += delegate { int pageNumber; int.TryParse(_txtPageNumber.Text, out pageNumber); if ((pageNumber <= 0) || (pageNumber > PDFDocument.PageCount)) { using (var alert = new UIAlertView("Error".t(), "Invalid page number".t(), null, "Ok")) { alert.Show(); } } else { _callbackAction(pageNumber); } DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var toolBarTitle = new UILabel(new CGRect(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Go to page".t(); var toolBar = new UIToolbar(new CGRect(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnApply, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _txtPageNumber = new UITextField(new CGRect(20, 58, View.Bounds.Width - 40, 31)); _txtPageNumber.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _txtPageNumber.BorderStyle = UITextBorderStyle.RoundedRect; _txtPageNumber.KeyboardType = UIKeyboardType.NumberPad; _txtPageNumber.Font = UIFont.SystemFontOfSize(17.0f); _txtPageNumber.Placeholder = "Enter page number".t(); View.AddSubview(_txtPageNumber); }
void SetUpToolbar() { toolbar = new UIToolbar { TranslatesAutoresizingMaskIntoConstraints = false }; chatInputView = new ChatInputView { TranslatesAutoresizingMaskIntoConstraints = false }; toolbar.LayoutIfNeeded(); View.AddSubview(toolbar); if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { // iPhone X layout var safeGuide = View.SafeAreaLayoutGuide; toolbar.LeadingAnchor.ConstraintEqualTo(safeGuide.LeadingAnchor).Active = true; toolbar.TrailingAnchor.ConstraintEqualTo(safeGuide.TrailingAnchor).Active = true; toolbarHeightConstraint = toolbar.HeightAnchor.ConstraintEqualTo(44); toolbarHeightConstraint.Active = true; toolbarBottomConstraint = toolbar.BottomAnchor.ConstraintEqualTo(safeGuide.BottomAnchor); toolbarBottomConstraint.Active = true; } else { var pinLeft = NSLayoutConstraint.Create(toolbar, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1f, 0f); View.AddConstraint(pinLeft); var pinRight = NSLayoutConstraint.Create(toolbar, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, View, NSLayoutAttribute.Trailing, 1f, 0f); View.AddConstraint(pinRight); toolbarBottomConstraint = NSLayoutConstraint.Create(View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1f, 0f); View.AddConstraint(toolbarBottomConstraint); toolbarHeightConstraint = NSLayoutConstraint.Create(toolbar, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0f, 44f); View.AddConstraint(toolbarHeightConstraint); } toolbar.AddSubview(chatInputView); var c1 = NSLayoutConstraint.FromVisualFormat("H:|[chat_container_view]|", 0, "chat_container_view", chatInputView ); var c2 = NSLayoutConstraint.FromVisualFormat("V:|[chat_container_view]|", 0, "chat_container_view", chatInputView ); toolbar.AddConstraints(c1); toolbar.AddConstraints(c2); }
//======================================================================================================================================== // PUBLIC OVERRIDES //======================================================================================================================================== /// <summary> /// Add the UIToolBar to the view, add the UISegmentController to the UINavigationBar, set the controller title, add our two /// segment controller affected views to the controller view and set the view associated with the inactive segmentController state /// to hidden and subscribe a delegate to the event in our UISegmentController subclass. /// </summary> public override void ViewDidLoad() { Title = contentViewTitleText; optionsButton = new UIBarButtonItem(optionsButtonText, UIBarButtonItemStyle.Plain, buttonSelected); NavigationItem.SetLeftBarButtonItem(optionsButton, true); View.AddSubviews(new UIView[] { firstView, secondView }); View.Add(toolBar); secondView.Hidden = true; segController.valueChanged += changeBackgroundColor; toolBar.AddSubview(segController); base.ViewDidLoad(); }
private void SetNavBarColor() { navBar.BarStyle = UIBarStyle.Black; var frame = new RectangleF(0f, 0f, this.View.Bounds.Width, 40f); using (var v = new UIView(frame)) { using (var imageView = new UIImageView(UIImage.FromFile("/Images/TabBarBackground.png"))) { imageView.Frame = frame; imageView.Alpha = 0.43f; navBar.AddSubview(imageView); } } }
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); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Show a streets basemap. _myMapView.Map = new Map(Basemap.CreateStreets()); // Respond to taps on the map. _myMapView.GeoViewTapped += MapView_GeoViewTapped; // Add the controls to the view. View.AddSubviews(_myMapView, _toolbar); // Add the help label to the toolbar. _toolbar.AddSubview(_helpLabel); }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnApply = new UIBarButtonItem(); btnApply.Image = UIImage.FromFile("apply.png"); btnApply.Clicked += delegate { _note.Note = _txtNote.Text; MgrAccessor.DocumentNoteMgr.Save(_note); DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Note".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnApply, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _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 SetUpToolbar() { toolbar = new UIToolbar { TranslatesAutoresizingMaskIntoConstraints = false }; chatInputView = new ChatInputView { TranslatesAutoresizingMaskIntoConstraints = false }; View.AddSubview(toolbar); var pinLeft = NSLayoutConstraint.Create(toolbar, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1f, 0f); View.AddConstraint(pinLeft); var pinRight = NSLayoutConstraint.Create(toolbar, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, View, NSLayoutAttribute.Trailing, 1f, 0f); View.AddConstraint(pinRight); toolbarBottomConstraint = NSLayoutConstraint.Create(View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1f, 0f); View.AddConstraint(toolbarBottomConstraint); toolbarHeightConstraint = NSLayoutConstraint.Create(toolbar, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0f, 44f); View.AddConstraint(toolbarHeightConstraint); toolbar.AddSubview(chatInputView); var c1 = NSLayoutConstraint.FromVisualFormat("H:|[chat_container_view]|", 0, "chat_container_view", chatInputView ); var c2 = NSLayoutConstraint.FromVisualFormat("V:|[chat_container_view]|", 0, "chat_container_view", chatInputView ); toolbar.AddConstraints(c1); toolbar.AddConstraints(c2); }
public override void ViewDidLoad() { base.ViewDidLoad(); var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var toolBarTitle = new UILabel(new CGRect(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Thumbs".t(); var toolBar = new UIToolbar(new CGRect(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _thumbsViewContainer = new UIView(new CGRect(0, 44, View.Bounds.Width, View.Bounds.Height - 85)); _thumbsViewContainer.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _thumbsViewContainer.BackgroundColor = UIColor.Gray; View.AddSubview(_thumbsViewContainer); _thumbsPageControl = new UIPageControl(new CGRect(0, View.Bounds.Height - 30, View.Bounds.Width, 20)); _thumbsPageControl.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; _thumbsPageControl.ValueChanged += delegate { createThumbsPage((int)_thumbsPageControl.CurrentPage); }; View.AddSubview(_thumbsPageControl); }
private void setBottomToolBar() { var scrollFrame = parentScrollView.Frame; bottomBar = new UIToolbar (new RectangleF (scrollFrame.X, scrollFrame.Height, scrollFrame.Width, bottomBarH)){TintColor = UIColor.Black}; calViewSwitcher = new UISegmentedControl (new RectangleF (scrollFrame.Width / 2 - 90, 5, 180, 28)); calViewSwitcher.InsertSegment ("Day", 0, false); calViewSwitcher.InsertSegment ("Month", 1, false); calViewSwitcher.InsertSegment ("Week", 2, false); calViewSwitcher.ControlStyle = UISegmentedControlStyle.Bar; calViewSwitcher.SelectedSegment = Settings.lastCal; calViewSwitcher.ValueChanged += delegate {Settings.lastCal = calViewSwitcher.SelectedSegment; ViewSwitched (); }; calViewSwitcher.TintColor = UIColor.Black; //calViewSwitcher.Selected todayBtn = new UIBarButtonItem ("Today", UIBarButtonItemStyle.Bordered, delegate { curScrollH = GetStartPosition (DateTime.Now); curScrollW = 0; SetDate (DateTime.Today); }); //UIToolbar toolbar = new UIToolbar(new RectangleF(5,0,75,35)); //toolbar.TintColor = UIColor.Clear; //toolbar.BackgroundColor = UIColor.Clear; //toolbar.SetItems(new UIBarButtonItem[]{todayBtn},false); bottomBar.SetItems (new UIBarButtonItem[] { todayBtn }, false); //bottomBar.AddSubview(toolbar); bottomBar.AddSubview (calViewSwitcher); }
/// <summary> /// Calls when view are loaded /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); // Create toolbar, title label and buttons 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 = "Bookmarks".t(); var btnAddBookmark = new UIButton(new RectangleF(5, 5, 30, 30)); btnAddBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkAdd32.png"), UIControlState.Normal); btnAddBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIButton(new RectangleF(43, 5, 30, 30)); btnDeleteBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkDelete32.png"), UIControlState.Normal); btnDeleteBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Delete); }; toolBar.AddSubview(toolBarTitle); toolBar.AddSubview(btnAddBookmark); toolBar.AddSubview(btnDeleteBookmark); View.AddSubview(toolBar); // Create bookmarks table mBookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); mBookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; mBookmarksTable.RowHeight = 55; mBookmarksTable.Source = new DataSource(this); View.AddSubview(mBookmarksTable); // Create bookmark cell and text field mNewBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); mNewBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; mNewBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); mNewBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); mNewBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; mNewBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; mNewBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); mNewBookmarkCell.AddSubview(mNewBookmarkNameTxt); }
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)); }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnApply = new UIBarButtonItem(); btnApply.Image = UIImage.FromFile("apply.png"); btnApply.Clicked += delegate { int pageNumber; int.TryParse(_txtPageNumber.Text, out pageNumber); if ((pageNumber <= 0) || (pageNumber > PDFDocument.PageCount)) { using (var alert = new UIAlertView("Error".t(), "Invalid page number".t(), null, "Ok")) { alert.Show(); } } else { _callbackAction(pageNumber); } DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Go to page".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnApply, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _txtPageNumber = new UITextField(new RectangleF(20, 58, View.Bounds.Width - 40, 31)); _txtPageNumber.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _txtPageNumber.BorderStyle = UITextBorderStyle.RoundedRect; _txtPageNumber.KeyboardType = UIKeyboardType.NumberPad; _txtPageNumber.Font = UIFont.SystemFontOfSize(17.0f); _txtPageNumber.Placeholder = "Enter page number".t(); View.AddSubview(_txtPageNumber); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; UIToolbar topToolbar = new UIToolbar(); topToolbar.TranslatesAutoresizingMaskIntoConstraints = false; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _timeLabel = new UILabel { TextColor = UIColor.Black, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; _timeSlider = new UISlider { MinValue = 0, MaxValue = 1, TranslatesAutoresizingMaskIntoConstraints = false }; UIToolbar bottomToolbar = new UIToolbar(); bottomToolbar.TranslatesAutoresizingMaskIntoConstraints = false; bottomToolbar.Items = new[] { new UIBarButtonItem(_timeLabel), new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 0 }, new UIBarButtonItem(_timeSlider) }; 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.LeadingAnchor), bottomToolbar.TrailingAnchor.ConstraintEqualTo(View.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), }); }
void SetUpToolbar () { toolbar = new UIToolbar { TranslatesAutoresizingMaskIntoConstraints = false }; chatInputView = new ChatInputView { TranslatesAutoresizingMaskIntoConstraints = false }; View.AddSubview (toolbar); var pinLeft = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1, 0); View.AddConstraint (pinLeft); var pinRight = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, View, NSLayoutAttribute.Trailing, 1, 0); View.AddConstraint (pinRight); toolbarBottomConstraint = NSLayoutConstraint.Create (View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toolbar, NSLayoutAttribute.Bottom, 1, 0); View.AddConstraint (toolbarBottomConstraint); toolbarHeightConstraint = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0, 44); View.AddConstraint (toolbarHeightConstraint); toolbar.AddSubview (chatInputView); var c1 = NSLayoutConstraint.FromVisualFormat ("H:|[chat_container_view]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "chat_container_view", chatInputView ); var c2 = NSLayoutConstraint.FromVisualFormat ("V:|[chat_container_view]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "chat_container_view", chatInputView ); toolbar.AddConstraints (c1); toolbar.AddConstraints (c2); }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnAddBookmark = new UIBarButtonItem(); btnAddBookmark.Image = UIImage.FromFile("add.png"); btnAddBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIBarButtonItem(); btnDeleteBookmark.Image = UIImage.FromFile("delete.png"); btnDeleteBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Delete); }; var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Bookmarks".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin |UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnAddBookmark, btnDeleteBookmark, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _bookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); _bookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; _bookmarksTable.Source = new DataSource(this); View.AddSubview(_bookmarksTable); _newBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); _newBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; _newBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); _newBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); _newBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _newBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; _newBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); _newBookmarkCell.AddSubview(_newBookmarkNameTxt); }
public override void ViewDidLoad() { base.ViewDidLoad(); var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Thumbs".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _thumbsViewContainer = new UIView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height - 85)); _thumbsViewContainer.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _thumbsViewContainer.BackgroundColor = UIColor.Gray; View.AddSubview(_thumbsViewContainer); _thumbsPageControl = new UIPageControl(new RectangleF(0, View.Bounds.Height - 30, View.Bounds.Width, 20)); _thumbsPageControl.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; _thumbsPageControl.ValueChanged += delegate { createThumbsPage(_thumbsPageControl.CurrentPage); }; View.AddSubview(_thumbsPageControl); }