本文整理汇总了C#中UIToolbar类的典型用法代码示例。如果您正苦于以下问题:C# UIToolbar类的具体用法?C# UIToolbar怎么用?C# UIToolbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIToolbar类属于命名空间,在下文中一共展示了UIToolbar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
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 };
}
开发者ID:mikebluestein,项目名称:TalkBot,代码行数:35,代码来源:SpeechItemTableController.cs
示例2: ViewDidLoad
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 };
}
开发者ID:mikebluestein,项目名称:TalkBot,代码行数:35,代码来源:SpeechItemTableController.cs
示例3: AddDoneButton
/// <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;
}
}*/
}
开发者ID:unger,项目名称:ArtportalenApp,代码行数:33,代码来源:CustomSearchBarRenderer.cs
示例4: Create
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;
}
开发者ID:GDownes,项目名称:ReactiveTrader,代码行数:31,代码来源:PriceTileViewCell.cs
示例5: UIBlurView
public UIBlurView()
{
BackgroundColor = UIColor.Clear;
Add(toolbar = new UIToolbar {
Translucent =true,
});
}
开发者ID:Clancey,项目名称:iOSHelpers,代码行数:7,代码来源:UIBlurView.cs
示例6: 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);
}
开发者ID:kenLa,项目名称:mTouch-PDFReader,代码行数:33,代码来源:NoteViewController.cs
示例7: ViewDidLoad
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;
}
开发者ID:tremors,项目名称:ios-sdk,代码行数:29,代码来源:ListViewUpdate.cs
示例8: ViewDidLoad
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,
};
}
开发者ID:AnnMarieTorres,项目名称:XamChat,代码行数:34,代码来源:MessagesController.cs
示例9: UIMonthTextField
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;
}
开发者ID:bertouttier,项目名称:ExpenseApp-Mono,代码行数:30,代码来源:UIMonthTextField.cs
示例10: ViewDidLoad
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;
}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:28,代码来源:DatePickerExampleViewController.cs
示例11: ViewDidLoad
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);
}
开发者ID:ganeshan,项目名称:Monospace11,代码行数:34,代码来源:WebViewController.cs
示例12: SetupPicker
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;
}
开发者ID:13daysaweek,项目名称:MonoTouchUIPickerView,代码行数:32,代码来源:MonoTouchUIPickerViewViewController.cs
示例13: UiSetKeyboardEditorWithCloseButton
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;
}
开发者ID:nodoid,项目名称:mvvmlight1,代码行数:32,代码来源:UIUtils.cs
示例14: ViewDidLoad
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 });
}
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:28,代码来源:WebViewController.cs
示例15: ViewDidLoad
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;
}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:34,代码来源:PickerExampleViewController.cs
示例16: 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));
}
开发者ID:GodTamIt,项目名称:whispr-messenger,代码行数:35,代码来源:ChatViewController.cs
示例17: ViewWillAppear
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);
}
开发者ID:powerdude,项目名称:XamarinSamples,代码行数:25,代码来源:ToolbarRenderer.cs
示例18: ViewDidLoad
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);
}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:28,代码来源:TSAccountBasicView.cs
示例19: UICurrencyTextField
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;
}
开发者ID:bertouttier,项目名称:ExpenseApp-Mono,代码行数:30,代码来源:UICurrencyTextField.cs
示例20: OnElementChanged
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;
};
}
开发者ID:rlingineni,项目名称:Xamarin.Forms-ChatMessenger,代码行数:59,代码来源:ScalableEntryRenderer.cs
注:本文中的UIToolbar类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论