当前位置: 首页>>代码示例>>C#>>正文


C# UITextField类代码示例

本文整理汇总了C#中UITextField的典型用法代码示例。如果您正苦于以下问题:C# UITextField类的具体用法?C# UITextField怎么用?C# UITextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UITextField类属于命名空间,在下文中一共展示了UITextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewDidLoad

        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            var label = new UILabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var button = new UIButton(UIButtonType.RoundedRect);
            button.SetTitle("Click Me", UIControlState.Normal);
            button.Frame = new RectangleF(10, 90, 300, 40);
            Add(button);
            var button2 = new UIButton(UIButtonType.RoundedRect);
            button2.SetTitle("Go Second", UIControlState.Normal);
            button2.Frame = new RectangleF(10, 130, 300, 40);
            Add(button2);

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).To(vm => vm.Hello);
            set.Bind(textField).To(vm => vm.Hello);
            set.Bind(button).To(vm => vm.MyCommand);
            set.Bind(button2).To(vm => vm.GoSecondCommand);
            set.Apply();
        }
开发者ID:janvdp,项目名称:NPlus1DaysOfMvvmCross,代码行数:25,代码来源:FirstView.cs

示例2: ConfigureTextField

 void ConfigureTextField(UITextField field)
 {
     field.LeftView = new UIView (new RectangleF(0, 0, 5, 31));
     field.LeftViewMode = UITextFieldViewMode.Always;
     field.ShouldReturn = TextFieldShouldReturn;
     Xamarin.Themes.CashflowTheme.Apply (field);
 }
开发者ID:alleeclark,项目名称:morganHack,代码行数:7,代码来源:AnotherElementsViewController.cs

示例3: initCell

		//========================================================================================================================================
		//  PRIVATE METHODS
		//========================================================================================================================================
		private void initCell()
		{
			this.TextLabel.Text = "On:";
			this.TextLabel.TextColor = UIColor.LightGray;
			this.tf = new UITextField ();
			this.AccessoryView = tf;
		}
开发者ID:CheezeCoder,项目名称:AaronBratcher_TableViewHelper_Xamarin,代码行数:10,代码来源:DateShowerCell.cs

示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;
            base.ViewDidLoad();

            var button = new UIButton(UIButtonType.RoundedRect);
            button.SetTitle("Search", UIControlState.Normal);
            Add(button);

            var text = new UITextField() { BorderStyle = UITextBorderStyle.RoundedRect };
            Add(text);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var set = this.CreateBindingSet<SearchView, SearchViewModel>();
            set.Bind(button).To("Search");
            set.Bind(text).To(vm => vm.SearchText);
            set.Apply();

            var hPadding = 10;
            var vPadding = 10;
            var ButtonWidth = 100;

            View.AddConstraints(

                    button.AtTopOf(View).Plus(vPadding),
                    button.AtRightOf(View).Minus(hPadding),
                    button.Width().EqualTo(ButtonWidth),

                    text.AtLeftOf(View, hPadding),
                    text.ToLeftOf(button, hPadding),
                    text.WithSameTop(button)

                );
        }
开发者ID:Dexyon,项目名称:MvvmCross-Samples,代码行数:35,代码来源:SearchView.cs

示例5: ViewDidLoad

        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;


            var label = new ShapeLabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var shapeView = new ShapeView(new RectangleF(60, 90, 200, 200));
            Add(shapeView);

            var picker = new UIPickerView();
            var pickerViewModel = new MvxPickerViewModel(picker);
            picker.Model = pickerViewModel;
            picker.ShowSelectionIndicator = true;
            textField.InputView = picker;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).For(s => s.TheShape).To(vm => vm.Shape);
            set.Bind(textField).To(vm => vm.Shape);
            set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.List);
            set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Shape);
            set.Bind(shapeView).For(s => s.TheShape).To(vm => vm.Shape);
            set.Apply();

            var g = new UITapGestureRecognizer(() => textField.ResignFirstResponder());
            View.AddGestureRecognizer(g);
        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:34,代码来源:FirstView.cs

示例6: OnValidateName

	private string OnValidateName( UITextField field, string text, ref int insPos)
	{
		while( true)
		{
			int byteCount = System.Text.UTF8Encoding.UTF8.GetByteCount( text);
//			int charCount = System.Text.UTF8Encoding.UTF8.GetCharCount( System.Text.UTF8Encoding.UTF8.GetBytes( text));
			if( byteCount <= AsGameDefine.ePARTYNOTICE)
				break;

			text = text.Remove( text.Length - 1);
		}
		
		// #22671
		int index = 0;
		
		index =  text.IndexOf('\'');
		if(-1 != index)
			text = text.Remove( index);
		
		index =  text.IndexOf('\n');
		if(-1 != index)
			text = text.Remove( index);
		
		index =  text.IndexOf('\r');
		if(-1 != index)
			text = text.Remove( index);		
		
		return text;
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:29,代码来源:AsPartyPRDlg.cs

示例7: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// Perform any additional setup after loading the view, typically from a nib.

			var textView = new UITextField
			{
				Placeholder = "Your name",
				BorderStyle = UITextBorderStyle.RoundedRect,
				Frame = new RectangleF(10, 10, 200, 50)
			};

			//textView .AddConstraints (new[] {

				//size
			//	NSLayoutConstraint.Create (textView , NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 14),
			//	NSLayoutConstraint.Create (textView , NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 80),

				//location
			//	NSLayoutConstraint.Create (textView , NSLayoutAttribute.Left, NSLayoutRelation.Equal, mainView, NSLayoutAttribute.Left, 1, 10),
			//	NSLayoutConstraint.Create (textView , NSLayoutAttribute.Top, NSLayoutRelation.Equal, mainView, NSLayoutAttribute.Top, 1, 10),
			///
			//});

			this.View.AddSubview(textView);
		}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:27,代码来源:iOSLayoutExamplesViewController.cs

示例8: ShoudChange

        public static bool ShoudChange(UITextField textField, NSRange range, string toString)
        {
            int length = getLength (textField.Text);

            if(length == 10)
            {
                if(range.Length == 0)
                    return false;
            }

            if(length == 3)
            {
                string num = formatNumber(textField.Text);
                textField.Text = string.Format ("({0}) ", num);
                if(range.Length > 0)
                    textField.Text = string.Format ("{0}", num.Substring(0, 3));
            }
            else if(length == 6)
            {
                string num = formatNumber(textField.Text);

                textField.Text = string.Format ("({0}) {1}-",num.Substring (0, 3) ,num.Substring (3));
                if(range.Length > 0)
                    textField.Text = string.Format ("({0}) {1}",num.Substring (0, 3) ,num.Substring (3));
            }

            return true;
        }
开发者ID:bholmes,项目名称:XamarinEvolve2013Project,代码行数:28,代码来源:PhoneNumberHelper.cs

示例9: PersonView

        public PersonView()
        {
            BackgroundColor = UIColor.LightGray;

            var textFieldName = new UITextField(new RectangleF(10, 10, 320, 40));
            Add(textFieldName);
            var textFieldLastName = new UITextField(new RectangleF(10, 50, 320, 40));
            Add(textFieldLastName);

            var addressView = new AddressUIView();
            addressView.Frame = new RectangleF(10, 90, 320, 140);
            Add(addressView);

            var addressView2 = new AddressUIView();
            addressView2.Frame = new RectangleF(10, 250, 320, 140);
            addressView2.BackgroundColor = UIColor.Red;
            Add(addressView2);

            this.DelayBind(() =>
            {
                var set = this.CreateBindingSet<PersonView, PersonViewModel>();
                set.Bind(textFieldName).To(vm => vm.FirstName);
                set.Bind(textFieldLastName).To(vm => vm.LastName);
                set.Bind(addressView).For(add => add.DataContext).To(vm => vm.HomeAddress);
                set.Bind(addressView2).For(add => add.DataContext).To(vm => vm.WorkAddress);
                set.Apply();
            });
        }        
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:28,代码来源:FirstView.cs

示例10: makeSettings

		public static void makeSettings(UIHelperBase helper) {
			UIHelperBase group = helper.AddGroup("Traffic Manager: President Edition (Settings are defined for each savegame separately)");
			simAccuracyDropdown = group.AddDropdown("Simulation accuracy (higher accuracy reduces performance):", new string[] { "Very high", "High", "Medium", "Low", "Very Low" }, simAccuracy, onSimAccuracyChanged) as UIDropDown;
			recklessDriversDropdown = group.AddDropdown("Reckless driving (BETA feature):", new string[] { "Path Of Evil (10 %)", "Rush Hour (5 %)", "Minor Complaints (2 %)", "Holy City (0 %)" }, recklessDrivers, onRecklessDriversChanged) as UIDropDown;
			relaxedBussesToggle = group.AddCheckbox("Busses may ignore lane arrows", relaxedBusses, onRelaxedBussesChanged) as UICheckBox;
#if DEBUG
			allRelaxedToggle = group.AddCheckbox("All vehicles may ignore lane arrows", allRelaxed, onAllRelaxedChanged) as UICheckBox;
#endif
			mayEnterBlockedJunctionsToggle = group.AddCheckbox("Vehicles may enter blocked junctions", mayEnterBlockedJunctions, onMayEnterBlockedJunctionsChanged) as UICheckBox;
			UIHelperBase groupAI = helper.AddGroup("Advanced Vehicle AI");
			advancedAIToggle = groupAI.AddCheckbox("Enable Advanced Vehicle AI", advancedAI, onAdvancedAIChanged) as UICheckBox;
			highwayRulesToggle = groupAI.AddCheckbox("Enable highway specific lane merging/splitting rules", highwayRules, onHighwayRulesChanged) as UICheckBox;
			laneChangingRandomizationDropdown = groupAI.AddDropdown("Drivers want to change lanes (only applied if Advanced AI is enabled):", new string[] { "Very often (50 %)", "Often (25 %)", "Sometimes (10 %)", "Rarely (5 %)", "Very rarely (2.5 %)", "Only if necessary" }, laneChangingRandomization, onLaneChangingRandomizationChanged) as UIDropDown;
//#if DEBUG
			UIHelperBase senseAI = helper.AddGroup("Avoidance of lanes with high traffic density (low - high)");
			carCityTrafficSensitivitySlider = senseAI.AddSlider("Cars, city:", 0f, 1f, 0.05f, carCityTrafficSensitivity, onCarCityTrafficSensitivityChange) as UISlider;
			carHighwayTrafficSensitivitySlider = senseAI.AddSlider("Cars, highway:", 0f, 1f, 0.05f, carHighwayTrafficSensitivity, onCarHighwayTrafficSensitivityChange) as UISlider;
			truckCityTrafficSensitivitySlider = senseAI.AddSlider("Trucks, city:", 0f, 1f, 0.05f, truckCityTrafficSensitivity, onTruckCityTrafficSensitivityChange) as UISlider;
			truckHighwayTrafficSensitivitySlider = senseAI.AddSlider("Trucks, highway:", 0f, 1f, 0.05f, truckHighwayTrafficSensitivity, onTruckHighwayTrafficSensitivityChange) as UISlider;
//#endif
			UIHelperBase group2 = helper.AddGroup("Maintenance");
			group2.AddButton("Forget toggled traffic lights", onClickForgetToggledLights);
			nodesOverlayToggle = group2.AddCheckbox("Show nodes and segments", nodesOverlay, onNodesOverlayChanged) as UICheckBox;
			showLanesToggle = group2.AddCheckbox("Show lanes", showLanes, onShowLanesChanged) as UICheckBox;
#if DEBUG
			pathCostMultiplicatorField = group2.AddTextfield("Pathcost multiplicator", String.Format("{0:0.##}", pathCostMultiplicator), onPathCostMultiplicatorChanged) as UITextField;
#endif
		}
开发者ID:akira-ishizaki,项目名称:Cities-Skylines-Traffic-Manager-President-Edition,代码行数:28,代码来源:Options.cs

示例11: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            emailField = new UITextField {
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType = UITextAutocorrectionType.No,
                KeyboardType = UIKeyboardType.EmailAddress,
                Placeholder = "Email",
                Frame = new RectangleF (10, 60, 300, 33),
                ReturnKeyType = UIReturnKeyType.Next,
                ShouldReturn = delegate {
                    passwordField.BecomeFirstResponder ();
                    return true;
                },
            };
            View.AddSubview (emailField);

            passwordField = new UITextField {
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType = UITextAutocorrectionType.No,
                Placeholder = "Password",
                SecureTextEntry = true,
                Frame = new RectangleF (10, 110, 300, 33),
                ReturnKeyType = UIReturnKeyType.Done,
                ShouldReturn = delegate {
                    ResignFirstResponder ();
                    TrySignin ();
                    return true;
                },
            };
            View.AddSubview (passwordField);
        }
开发者ID:jorik041,项目名称:GooglePlus,代码行数:33,代码来源:AccountController.cs

示例12: LayoutSubviews

		public override void LayoutSubviews ()
		{
			// layout the stock UIAlertView control
			base.LayoutSubviews ();
			
			if(this.Subviews.Count() == 3)
			{
				// build out the text field
				_UserName = ComposeTextFieldControl (false);
				_Password = ComposeTextFieldControl (true);

				// add the text field to the alert view
				
				UIScrollView view = new UIScrollView(this.Frame);
				
				view.AddSubview(ComposeLabelControl("Username"));
				view.AddSubview (_UserName);
				view.AddSubview(ComposeLabelControl("Password"));
				view.AddSubview (_Password);
				
				this.AddSubview(view);
				
			}
			
			// shift the contents of the alert view around to accomodate the extra text field
			AdjustControlSize ();
			
		}
开发者ID:darkwood,项目名称:Jaktloggen,代码行数:28,代码来源:UIPopupLoginView.cs

示例13: ReleaseDesignerOutlets

 void ReleaseDesignerOutlets()
 {
     if (FocusTextField != null) {
         FocusTextField.Dispose ();
         FocusTextField = null;
     }
 }
开发者ID:liangzhuang,项目名称:xamarin-recipes,代码行数:7,代码来源:SetUITextFieldFocusViewController.designer.cs

示例14: ReleaseDesignerOutlets

		void ReleaseDesignerOutlets ()
		{
			if (itemText != null) {
				itemText.Dispose ();
				itemText = null;
			}
		}
开发者ID:soleary1222,项目名称:prayerapplication,代码行数:7,代码来源:QSTodoListViewController.designer.cs

示例15: ReleaseDesignerOutlets

		void ReleaseDesignerOutlets ()
		{
			if (DeleteButton != null) {
				DeleteButton.Dispose ();
				DeleteButton = null;
			}
			if (detail != null) {
				detail.Dispose ();
				detail = null;
			}
			if (DoneSwitch != null) {
				DoneSwitch.Dispose ();
				DoneSwitch = null;
			}
			if (NotesText != null) {
				NotesText.Dispose ();
				NotesText = null;
			}
			if (SaveButton != null) {
				SaveButton.Dispose ();
				SaveButton = null;
			}
			if (TitleText != null) {
				TitleText.Dispose ();
				TitleText = null;
			}
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:27,代码来源:TaskDetailViewController.designer.cs


注:本文中的UITextField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。