本文整理汇总了C#中UIToolbar.AddSubview方法的典型用法代码示例。如果您正苦于以下问题:C# UIToolbar.AddSubview方法的具体用法?C# UIToolbar.AddSubview怎么用?C# UIToolbar.AddSubview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIToolbar
的用法示例。
在下文中一共展示了UIToolbar.AddSubview方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
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);
}
示例2: setBottomToolBar
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);
}
示例3: ViewDidLoad
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);
}
示例4: ViewDidLoad
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);
}
示例5: SetUpToolbar
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);
}
示例6: ViewDidLoad
/// <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);
}
示例7: ViewDidLoad
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);
}
示例8: SetupToolbar
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));
}
示例9: ViewDidLoad
/// <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);
}
示例10: ViewDidLoad
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);
}