本文整理汇总了C#中UIButton.Title方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.Title方法的具体用法?C# UIButton.Title怎么用?C# UIButton.Title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIButton
的用法示例。
在下文中一共展示了UIButton.Title方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KeepMe
private void KeepMe()
{
// UIButon
var btn = new UIButton();
var title = btn.Title(UIControlState.Disabled);
btn.SetTitle("foo", UIControlState.Disabled);
btn.TitleLabel.Text = btn.TitleLabel.Text;
// UISlider
var slider = new UISlider();
slider.Value = slider.Value; // Get and set
// UITextView
var tv = new UITextView();
tv.Text = tv.Text;
// UITextField
var tf = new UITextField();
tv.Text = tf.Text;
// var UIImageView
var iv = new UIImageView();
iv.Image = iv.Image;
// UI Label
var lbl = new UILabel();
lbl.Text = lbl.Text;
// UI Control
var ctl = new UIControl();
ctl.Enabled = ctl.Enabled;
ctl.Selected = ctl.Selected;
EventHandler eh = (s, e) => { };
ctl.TouchUpInside += eh;
ctl.TouchUpInside -= eh;
// UIRefreshControl
var rc = new UIRefreshControl();
rc.ValueChanged += eh;
rc.ValueChanged -= eh;
// UIBarButtonItem
var bbi = new UIBarButtonItem();
bbi.Clicked += eh;
bbi.Clicked -= eh;
eh.Invoke(null, null);
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
var handler = new DoActionSheetHandler(Console.WriteLine);
var button = new UIButton(UIButtonType.System);
button.Title(UIControlState.Normal);
var buttons = new UIButton[] {
button
};
var sheet = new DoActionSheet();
sheet.ShowC("Cancel", buttons, handler);
}
示例3: Include
public void Include(UIButton uiButton)
{
uiButton.TouchUpInside += (s, e) =>
uiButton.SetTitle(uiButton.Title(UIControlState.Normal), UIControlState.Normal);
}
示例4: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
AnimateView animateView = new AnimateView();
//TODO: more info at: http://www.youtube.com/watch?v=6JePwHjVj6U
//MODAL PRESENTATION OF UIVIEW CONTROLLER--------------------------------------------------
//PRESENTATION STLYE IS FORM SHEET
btnTest.TouchUpInside += (object sender, EventArgs e) =>
{
AnimateModalViewController animateModalViewController = new AnimateModalViewController()
{
ModalTransitionStyle = UIModalTransitionStyle.CoverVertical,
ModalPresentationStyle = UIModalPresentationStyle.FormSheet,
};
this.NavigationController.PresentViewController(animateModalViewController,true,null);
};
//-----------------------------------------------------------------------------------------
//UIViewAnimation-----------------------------------------------------------------------------
//RECTANGLE ANIMATION (GO LEFT AND RETURN TO STARTING POINT
PointF p0;
UIView view = new UIView();
view.Frame = new RectangleF(20,20,200,200);
view.BackgroundColor = UIColor.Green;
this.View.Add(view);
btnCoreAnimation.TouchUpInside += (object sender, EventArgs e) =>
{
p0 = view.Center;
UIView.Animate(2,0,
UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.Autoreverse,
() =>
{
view.Center =
new PointF(
UIScreen.MainScreen.Bounds.Right - view.Frame.Width /2,
view.Center.Y
);
},
() => { view.Center = p0;}
);
};
//UIView ANIMATION (FADE IN FROM THE CENTER OF THE SCREEN)---------------------------------------------
PointF p1;
UIView view1 = new UIView();
view1.Frame = new RectangleF(this.View.Center.X,this.View.Center.Y,0,0);
view1.BackgroundColor = UIColor.Gray;
//DISMISS BUTTON FOR VIEW1
UIButton btnDismissView1 = new UIButton(UIButtonType.RoundedRect);
btnDismissView1.Frame = new RectangleF(318,687,133,44);
btnDismissView1.Title(UIControlState.Normal);
btnDismissView1.SetTitle("Dismiss View1",UIControlState.Normal);
//DISMISS VIEW1
btnDismissView1.TouchUpInside += (object sender, EventArgs e) =>
{
UIView.Animate(2,0,UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseIn,
() =>
{
btnDismissView1.RemoveFromSuperview();
view1.Frame = new RectangleF(this.View.Center.X,this.View.Center.Y,0,0);
},
() =>{view1.RemoveFromSuperview();}
);
};
//ADD VIEW1 AS SUBVIEW TO this.View
btnFadeInView.TouchUpInside += (object sender, EventArgs e) =>
{
this.View.Add(view1);
p1 = view1.Center;
UIView.Animate(2,0,UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseIn,
() =>
{
view1.Frame = new RectangleF(0,0,768,960);
},
() => {view1.Add(btnDismissView1);} //EMPTY, COULD BE USED FOR ACTION UPON COMPLETITION OF ANIMATION
);
};
//---------------------------------------------------------------------------------------------
//iOS built-in animations----------------------------------------------------------------------
btnCrossDissolve.TouchUpInside += (object sender, EventArgs e) =>
{
this.NavigationController.PushControllerWithTransition(animateView,
UIViewAnimationOptions.TransitionCrossDissolve);
};
//.........这里部分代码省略.........
示例5: _buttonInput
public void _buttonInput( UIButton button ){
MMNumberKeyboardButton keyboardButton = MMNumberKeyboardButton.None;
//https://github.com/xamarin/monotouch-samples/blob/master/AppPrefs/Settings.cs
//NSArray.FromArray<NSDictionary> (
// foreach (KeyValuePair<NSObject,NSObject> t in this.buttonDictionary.GetEnumerator<KeyValuePair<NSObject,NSObject>>()) {
//foreach (var t in this.buttonDictionary.GetEnumerator()) {
// this.buttonDictionary.
//foreach (var item in NSArray.FromArray<NSDictionary> (this.buttonDictionary.GetEnumerator)) {
for (nuint i = 0 ; i < this.buttonDictionary.Count; i++) {
//id key, id obj, BOOL *stop
NSObject key = this.buttonDictionary.Keys[i];
NSObject obj = this.buttonDictionary.Values[i];
MMNumberKeyboardButton k = (MMNumberKeyboardButton)Enum.Parse( typeof(MMNumberKeyboardButton), key.ToString());
if (button == obj) {
keyboardButton = k;
//stop = true;
break;
}
}
if (keyboardButton == MMNumberKeyboardButton.None) {
return;
}
// Get first responder.
IUIKeyInput keyInput = this.keyInput;
MMNumberKeyboardDelegate Delegate = this.Delegate;
if (!(keyInput!=null)) {
return;
}
// Handle number.
/*const*/ MMNumberKeyboardButton numberMin = MMNumberKeyboardButton.NumberMin;
/*const*/ MMNumberKeyboardButton numberMax = MMNumberKeyboardButton.NumberMax;
if (keyboardButton >= numberMin && keyboardButton < numberMax) {
NSNumber number = NSNumber.FromNInt(keyboardButton - numberMin);
string @string = number.ToString();
if (Delegate.RespondsToSelector(new Selector ("numberKeyboard:shouldAddText:"))) {
//bool shouldAdd = Delegate.numberKeyboard(this ,/*shouldAddText*/ @string);
//bool shouldAdd = Delegate.Invoke("numberKeyboard", new [] {this ,/*shouldAddText*/ @string});
bool shouldAdd = (bool) Delegate.Invoke("numberKeyboard", this ,/*shouldAddText*/ @string);
if (!shouldAdd) {
return;
}
}
keyInput.InsertText(@string);
}
// Handle backspace.
else if (keyboardButton == MMNumberKeyboardButton.Backspace) {
keyInput.DeleteBackward();
}
// Handle done.
else if (keyboardButton == MMNumberKeyboardButton.Done) {
bool shouldReturn = true;
if (Delegate.RespondsToSelector(new Selector ("numberKeyboardShouldReturn*/ "))) {
shouldReturn = (bool) Delegate.Invoke("numberKeyboardShouldReturn", this);
}
if (shouldReturn) {
this._dismissKeyboard(button);
}
}
// Handle special key.
else if (keyboardButton == MMNumberKeyboardButton.Special) {
Action handler = this.specialKeyHandler;
if (handler!=null) {
handler();
}
}
// Handle .
else if (keyboardButton == MMNumberKeyboardButton.DecimalPoint) {
string decimalText = button.Title(UIControlState.Normal);
if (Delegate.RespondsToSelector(new Selector ("numberKeyboard:shouldAddText:"))) {
bool shouldAdd = (bool) Delegate.Invoke("numberKeyboard", new object[] {this ,/*shouldAddText*/ decimalText});
if (!shouldAdd) {
return;
}
}
keyInput.InsertText(decimalText);
}
}