本文整理汇总了C#中UIActionSheet.AddSubview方法的典型用法代码示例。如果您正苦于以下问题:C# UIActionSheet.AddSubview方法的具体用法?C# UIActionSheet.AddSubview怎么用?C# UIActionSheet.AddSubview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIActionSheet
的用法示例。
在下文中一共展示了UIActionSheet.AddSubview方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActionSheetDatePicker
/// <summary>
///
/// </summary>
public ActionSheetDatePicker(UIView owner)
{
// save our uiview owner
this.owner = owner;
// configure the title label
titleLabel.BackgroundColor = UIColor.Clear;
titleLabel.TextColor = UIColor.LightTextColor;
titleLabel.Font = UIFont.BoldSystemFontOfSize (18);
// configure the done button
doneButton.SetTitle ("done", UIControlState.Normal);
doneButton.TouchUpInside += (s, e) => {
actionSheet.DismissWithClickedButtonIndex (0, true);
// Add DoneButtonClicked Event
//Console.WriteLine("Done clicked");
if (DoneButtonClicked != null)
{
DoneButtonClicked(s,e);
}
};
// expose done clicked event
// create + configure the action sheet
actionSheet = new UIActionSheet () { Style = UIActionSheetStyle.BlackTranslucent };
actionSheet.Clicked += (s, e) => { Console.WriteLine ("Clicked on item {0}", e.ButtonIndex); };
// add our controls to the action sheet
actionSheet.AddSubview (datePicker);
actionSheet.AddSubview (titleLabel);
actionSheet.AddSubview (doneButton);
}
示例2: ActionSheetPicker
/// <summary>
///
/// </summary>
public ActionSheetPicker(UIView owner)
{
// save our uiview owner
this._owner = owner;
// configure the title label
titleLabel.BackgroundColor = UIColor.Clear;
titleLabel.TextColor = UIColor.LightTextColor;
titleLabel.Font = UIFont.BoldSystemFontOfSize (18);
// create + configure the action sheet
_actionSheet = new UIActionSheet () { Style = UIActionSheetStyle.BlackTranslucent };
_actionSheet.Clicked += (s, e) => { Console.WriteLine ("Clicked on item {0}", e.ButtonIndex); };
// add our controls to the action sheet
_actionSheet.AddSubview (picker);
_actionSheet.AddSubview (titleLabel);
//actionSheet.AddSubview (doneButton);
// Add the toolbar
_toolbar = new UIToolbar(new RectangleF(0, 0, _actionSheet.Frame.Width, 10));
_toolbar.BarStyle = UIBarStyle.Black;
_toolbar.Translucent = true;
// Add the done button
_doneButton = new UIBarButtonItem("Aceptar",UIBarButtonItemStyle.Done, null);
_doneButton.Clicked += (object sender, EventArgs e) => {
_actionSheet.DismissWithClickedButtonIndex (0, true);
};
_toolbar.Items = new UIBarButtonItem[] {
new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null, null),
_doneButton
};
_toolbar.SizeToFit();
_actionSheet.Add (_toolbar);
}
示例3: SetupSpeechPopup
public void SetupSpeechPopup(string text)
{
SpeechPopup = new UIActionSheet(" ", SpeechPopupDelegate, "Cancel", "Done");
// center and add the activity indicator
ActivityIndicator.Center = new System.Drawing.PointF(this.View.Center.X, ActivityIndicator.Center.Y);
SpeechPopup.AddSubview(ActivityIndicator);
// make a label with a bigger font and add it as a subview to overlay the current label
//RectangleF oldFrame = SpeechPopup.Subviews[0].Frame;
SpeechTextLabel.Font = UIFont.BoldSystemFontOfSize(17);
SpeechTextLabel.TextAlignment = UITextAlignment.Center;
SpeechTextLabel.BackgroundColor = UIColor.Clear;
SpeechTextLabel.TextColor = UIColor.White;
SpeechTextLabel.Text = text;
SpeechTextLabel.SizeToFit();
//SpeechTextLabel.Frame.Width += 20; // fudge factor to take care of differences between "listening" and "recognizing"
SpeechTextLabel.Center = new PointF(this.View.Center.X, ActivityIndicator.Center.Y);
SpeechPopup.AddSubview(SpeechTextLabel);
// start the animation
ActivityIndicator.StartAnimating();
}
示例4: ShowCountryPicker
partial void ShowCountryPicker(UIButton sender) {
if (this.Countries == null) {
this.Countries = new string[] { @"None",@"US",@"Canada",@"France",@"Australia",@"Brazil" };
}
var pickerSheet = new UIActionSheet(new RectangleF(0, 0, 320, 410));
pickerSheet.ShowInView(this.View);
pickerSheet.Bounds = new RectangleF(0, 0, 320, 410);
var countryPicker = new UIPickerView(pickerSheet.Bounds);
countryPicker.WeakDelegate = this;
countryPicker.DataSource = this;
countryPicker.ShowSelectionIndicator = true;
pickerSheet.AddSubview(countryPicker);
}
示例5: ShowPicker
public void ShowPicker(UIView viewForPicker)
{
sheet = new UIActionSheet();
sheet.AddSubview(this);
var toolbarPicker = new UIToolbar (new RectangleF (0, 0, viewForPicker.Frame.Width, 44)) {
Items = new[] {
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
new UIBarButtonItem (UIBarButtonSystemItem.Done, (sender, args) => sheet.DismissWithClickedButtonIndex (0, true)),
},
BarTintColor = this.BackgroundColor,
};
sheet.AddSubviews(toolbarPicker);
sheet.BackgroundColor = UIColor.Clear;
sheet.ShowInView(viewForPicker);
Animate(.25, () => sheet.Bounds = new RectangleF (0, 0, viewForPicker.Frame.Width, 485));
}
示例6: ActionSheetDatePickerCustom
public ActionSheetDatePickerCustom (UIView owner)
{
picker = new UIDatePicker (CGRect.Empty);
// save our uiview owner
this._owner = owner;
// create + configure the action sheet
_actionSheet = new UIActionSheet () { Style = UIActionSheetStyle.BlackTranslucent };
_actionSheet.Clicked += (s, e) => {
Console.WriteLine ("Clicked on item {0}", e.ButtonIndex);
};
// configure the title label
titleLabel = new UILabel (new CGRect (0, 0, _actionSheet.Frame.Width, 10));
titleLabel.BackgroundColor = UIColor.Clear;
titleLabel.TextColor = UIColor.Black;
titleLabel.Font = UIFont.BoldSystemFontOfSize (18);
// Add the toolbar
_toolbar = new UIToolbar (new CGRect (0, 0, _actionSheet.Frame.Width, 10));
_toolbar.BarStyle = UIBarStyle.Default;
_toolbar.Translucent = true;
// Add the done button
_doneButton = new UIBarButtonItem ("Gereed", UIBarButtonItemStyle.Done, null);
_toolbar.Items = new UIBarButtonItem[] {
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null, null),
_doneButton
};
_toolbar.SizeToFit ();
_actionSheet.AddSubview (picker);
_actionSheet.Add (_toolbar);
_actionSheet.AddSubview (titleLabel);
}
示例7: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
RegisterForKeyboardNotifications();
this.View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("backgrounds/Pattern_Cloth"));
this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Save, SaveButtonHandler), true);
myScrollView = new UIScrollView(new RectangleF(0,0,this.View.Bounds.Width,this.View.Bounds.Height));
myScrollView.ContentSize = new SizeF(this.View.Bounds.Width,this.View.Bounds.Height+25);
myScrollView.ContentInset = new UIEdgeInsets(0,0,25,0);
myScrollView.UserInteractionEnabled = true;
myScrollView.ScrollsToTop = true;
myScrollView.AlwaysBounceVertical = true;
myScrollView.Bounces = true;
this.View.AddSubview(myScrollView);
myLabel = new UILabel(new RectangleF(10,10,myScrollView.Bounds.Width-20,31));
myLabel.Text = "Scout Info";
myLabel.BackgroundColor = UIColor.Clear;
myLabel.Font = UIFont.BoldSystemFontOfSize(18);
myScrollView.AddSubview(myLabel);
myLabel = new UILabel(new RectangleF(10,51,100,31));
myLabel.Text = "First Name";
myLabel.BackgroundColor = UIColor.Clear;
myLabel.Font = UIFont.SystemFontOfSize(18);
myScrollView.AddSubview(myLabel);
txtFirstName = new UITextField(new RectangleF(112,51,190,31));
txtFirstName.Font = UIFont.SystemFontOfSize(18);
txtFirstName.BackgroundColor = UIColor.White;
txtFirstName.BorderStyle = UITextBorderStyle.RoundedRect;
txtFirstName.VerticalAlignment = UIControlContentVerticalAlignment.Center;
txtFirstName.ClearButtonMode = UITextFieldViewMode.WhileEditing;
myScrollView.AddSubview(txtFirstName);
myLabel = new UILabel(new RectangleF(10,87,100,31));
myLabel.Text = "Last Name";
myLabel.BackgroundColor = UIColor.Clear;
myLabel.Font = UIFont.SystemFontOfSize(18);
myScrollView.AddSubview(myLabel);
txtLastName = new UITextField(new RectangleF(112,87,190,31));
txtLastName.Font = UIFont.SystemFontOfSize(18);
txtLastName.BackgroundColor = UIColor.White;
txtLastName.BorderStyle = UITextBorderStyle.RoundedRect;
txtLastName.VerticalAlignment = UIControlContentVerticalAlignment.Center;
txtLastName.ClearButtonMode = UITextFieldViewMode.WhileEditing;
myScrollView.AddSubview(txtLastName);
myLabel = new UILabel(new RectangleF(10,123,100,31));
myLabel.Text = "Nickname";
myLabel.BackgroundColor = UIColor.Clear;
myLabel.Font = UIFont.SystemFontOfSize(18);
myScrollView.AddSubview(myLabel);
txtNickName = new UITextField(new RectangleF(112,123,190,31));
txtNickName.Font = UIFont.SystemFontOfSize(18);
txtNickName.BackgroundColor = UIColor.White;
txtNickName.BorderStyle = UITextBorderStyle.RoundedRect;
txtNickName.VerticalAlignment = UIControlContentVerticalAlignment.Center;
txtNickName.ClearButtonMode = UITextFieldViewMode.WhileEditing;
myScrollView.AddSubview(txtNickName);
myLabel = new UILabel(new RectangleF(10,159,100,31));
myLabel.Text = "Den";
myLabel.BackgroundColor = UIColor.Clear;
myLabel.Font = UIFont.SystemFontOfSize(18);
myScrollView.AddSubview(myLabel);
myActionSheet = new UIActionSheet();
myActionSheet.Style = UIActionSheetStyle.BlackTranslucent;
toolbarDen = new UIToolbar(RectangleF.Empty);
toolbarDen.BarStyle = UIBarStyle.Black;
toolbarDen.Translucent = true;
toolbarDen.UserInteractionEnabled = true;
toolbarDen.SizeToFit();
UIBarButtonItem btnCancel = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, PickerButtonCancelHandler);
UIBarButtonItem btnFlexibleSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null);
UIBarButtonItem btnDone = new UIBarButtonItem(UIBarButtonSystemItem.Done, PickerButtonDoneHandler);
UIBarButtonItem[] items = new UIBarButtonItem[] { btnCancel, btnFlexibleSpace, btnDone };
toolbarDen.SetItems(items, true);
myActionSheet.AddSubview(toolbarDen);
pickerDen = new UIPickerView(RectangleF.Empty);
myDenPicker = new DenPicker();
myDenPicker.Items.Add("");
myDenPicker.Items.Add("Tiger");
myDenPicker.Items.Add("Wolf");
myDenPicker.Items.Add("Bear");
myDenPicker.Items.Add("Weblo");
pickerDen.Source = myDenPicker;
pickerDen.UserInteractionEnabled = true;
pickerDen.ShowSelectionIndicator = true;
myActionSheet.AddSubview(pickerDen);
txtDen = new UITextField(new RectangleF(112,159,190,31));
txtDen.Font = UIFont.SystemFontOfSize(18);
txtDen.BackgroundColor = UIColor.White;
//.........这里部分代码省略.........
示例8: CreateCurrencyActionSheet
public UIActionSheet CreateCurrencyActionSheet(string title) {
UIActionSheet sheet = new UIActionSheet(title);
sheet.Style = UIActionSheetStyle.BlackTranslucent;
CurrencyPickerController = new CurrencyPickerSheet();
sheet.AddSubview(CurrencyPickerController.View);
return sheet;
}
示例9: ShowInActionSheet
/// <summary>
/// Shows me in an action sheet
/// </summary>
public void ShowInActionSheet(UIView container)
{
pickerSheet = new UIActionSheet ();
pickerSheet.ShowInView (container);
int height = 260;
var frame = new System.Drawing.RectangleF (0, container.Frame.Height-height, container.Frame.Width, height);
pickerSheet.Frame = frame;
this.View.Frame = new System.Drawing.RectangleF (0, 0, 320, height);
pickerSheet.AddSubview (this.View);
}
示例10: actionChangeKey
partial void actionChangeKey(NSObject sender)
{
_actionSheet = new UIActionSheet("Title", null, string.Empty, string.Empty, null);
var pickerView = new UIPickerView(new RectangleF(0, 44, 320, 300));
pickerView.ShowSelectionIndicator = true;
pickerView.WeakDelegate = this;
var toolbar = new UIToolbar(new RectangleF(0, 0, 320, 44));
toolbar.BarStyle = UIBarStyle.Black;
UIBarButtonItem flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
var button = new UIButton(UIButtonType.Custom);
button.SetTitle("Done", UIControlState.Normal);
button.Layer.CornerRadius = 8;
button.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor;
button.Font = UIFont.FromName("HelveticaNeue-Bold", 12.0f);
button.Frame = new RectangleF(0, 20, 60, 30);
button.TouchUpInside += (sender2, e) => {
int key = _keys[pickerView.SelectedRowInComponent(0)].Item1;
OnChangeKey(key);
_actionSheet.DismissWithClickedButtonIndex(0, true);
};
var btnDone = new UIBarButtonItem(button);
toolbar.SetItems(new UIBarButtonItem[2] { flexSpace, btnDone }, true);
_actionSheet.AddSubview(toolbar);
_actionSheet.AddSubview(pickerView);
_actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow);
_actionSheet.Bounds = new RectangleF(0, 0, 320, 344);
int index = _keys.IndexOf(_currentKey);
pickerView.Select(index, 0, false);
}
示例11: CameraTapped
void CameraTapped(object sender, EventArgs args)
{
if (Picture == null) {
TakePicture ();
return;
}
var sheet = new UIActionSheet ("");
sheet.AddButton ("discard picture");
sheet.AddButton ("pick new picture");
sheet.AddButton ("cancel");
sheet.CancelButtonIndex = 2;
if (this.InterfaceOrientation == UIInterfaceOrientation.Portrait) {
// Dummy buttons to preserve the space for the UIImageView
for (int i = 0; i < 4; i++) {
sheet.AddButton ("");
sheet.Subviews [i + 4].Alpha = 0;
}
var subView = new UIImageView (Picture);
subView.ContentMode = UIViewContentMode.ScaleAspectFill;
subView.Frame = new RectangleF (23, 185, 275, 210);
subView.Layer.CornerRadius = 10;
subView.Layer.MasksToBounds = true;
subView.Layer.BorderColor = UIColor.Black.CGColor;
sheet.AddSubview (subView);
}
sheet.Clicked += delegate(object ss, UIButtonEventArgs e) {
if (e.ButtonIndex == 2)
return;
if (e.ButtonIndex == 0) {
Picture = null;
SetUIBarButtons ();
} else
TakePicture ();
};
sheet.ShowInView (this.View);
}
示例12: ViewDidAppear
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear (animated);
// Set focus to entry box so the keyboard comes up immediately, making it faster and more obvious
// where to begin.
if (!viewShownOnce) {
this.InitialAmount.BecomeFirstResponder ();
viewShownOnce = true;
}
if (FooterController == null)
{
FooterController = new ConsequenceFooterViewController();
FooterController.AddConsequenceRequested += delegate(object sender, EventArgs e) {
if (TemplateSheetController == null)
{
TemplateSheetController = new TemplatePickerSheet(this.Profile);
TemplateSheetController.Cancelled += delegate {
TemplateActionSheet.DismissWithClickedButtonIndex(0,true);
};
TemplateSheetController.TemplateChosen += delegate(object _sender, TemplateChosenEventArgs _e) {
TemplateActionSheet.DismissWithClickedButtonIndex(0,true);
CreateNewConsequence(this.CurrentMode, _e.Template);
};
}
if (TemplateActionSheet == null)
{
TemplateActionSheet = new UIActionSheet("Add A Calculator");
TemplateActionSheet.AddSubview(TemplateSheetController.View);
}
TemplateActionSheet.ShowInView(this.View);
TemplateSheetController.View.Frame = new RectangleF(0,0,320,600);
TemplateActionSheet.Bounds = new RectangleF(0,0,320,600);
};
}
this.ConsequenceView.TableFooterView = FooterController.View;
}
示例13: ShowPicker
public void ShowPicker(UIView viewForPicker, RectangleF location)
{
var toolbar = new UIToolbar (new RectangleF (0, 0, 320, 44)) {
Items = new[] {
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
new UIBarButtonItem (UIBarButtonSystemItem.Done, (s, e) =>
{
if (sheet != null) {
sheet.DismissWithClickedButtonIndex (0, true);
sheet = null;
}
if (popover != null) {
popover.Dismiss(true);
popover = null;
}
})
},
BarStyle = UIBarStyle.Default,
};
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
sheet = new UIActionSheet ();
sheet.AddSubview (this);
sheet.AddSubviews (toolbar);
sheet.BackgroundColor = UIColor.Clear;
sheet.ShowInView (viewForPicker);
UIView.Animate (.25, () => sheet.Bounds = new RectangleF (0, 0, viewForPicker.Frame.Width, 485));
} else {
this.Frame = new RectangleF (0, 44, 320, 216);
var view = new UIView ();
view.Add (this);
view.Add (toolbar);
var vc = new UIViewController ();
vc.View = view;
vc.PreferredContentSize = new SizeF (320, 260);
popover = new UIPopoverController (vc);
popover.PresentFromRect (location, viewForPicker, UIPopoverArrowDirection.Down, true);
}
}