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


C# UISegmentedControl.SetWidth方法代码示例

本文整理汇总了C#中UISegmentedControl.SetWidth方法的典型用法代码示例。如果您正苦于以下问题:C# UISegmentedControl.SetWidth方法的具体用法?C# UISegmentedControl.SetWidth怎么用?C# UISegmentedControl.SetWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UISegmentedControl的用法示例。


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

示例1: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			this.Title = "Programmatic Segmented Controls";
			
			segControl1 = new UISegmentedControl ();
			segControl1.ControlStyle = UISegmentedControlStyle.Bordered;
			segControl1.InsertSegment ("One", 0, false);
			segControl1.InsertSegment ("Two", 1, false);
			segControl1.SetWidth (100f, 1);
			segControl1.SelectedSegment = 1;
			segControl1.Frame = new System.Drawing.RectangleF (20, 20, 280, 44);
			this.View.AddSubview (segControl1);
			
			segControl1.ValueChanged += delegate(object sender, EventArgs e) {
				Console.WriteLine ("Item " + (sender as UISegmentedControl).SelectedSegment.ToString () + " selected");
			};
			
		}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:20,代码来源:SegmentedControls2_iPhone.xib.cs

示例2: ViewDidLoad

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

			Title = "Programmatic Segmented Controls";

			segControl = new UISegmentedControl {
				Frame = new CGRect (20, 20, 280, 44),
				ControlStyle = UISegmentedControlStyle.Bordered,
				SelectedSegment = 1,
			};
			segControl.InsertSegment ("One", 0, false);
			segControl.InsertSegment ("Two", 1, false);
			segControl.SetWidth (100f, 1);
			View.AddSubview (segControl);

			segControl.ValueChanged += (object sender, EventArgs e) => {
				var selectedSegment = ((UISegmentedControl)sender).SelectedSegment;
				Console.WriteLine (string.Format ("Item {0} selected", selectedSegment));
			};
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:21,代码来源:SegmentedControls2_iPhone.xib.cs

示例3: ViewDidLoad

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

			if (!App.authManager.TicketExpired ()) {

				try {
					appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

					var repo = new RSContentRepository ();

					var accounts = await repo.GetAccounts ();
                    GetStrongPassword ();

					if (accounts.Count > 1) {
						var accountSwitch = new UIBarButtonItem (UIImage.FromBundle ("SwitchAccount")
						, UIBarButtonItemStyle.Plain
						, (sender, args) => {
							appDelegate.Window.RootViewController = Storyboard.InstantiateViewController ("AccountScreen") as RSAccountViewController;
						});

						accountSwitch.TintColor = UIColor.Clear.FromHexString (RSColors.MM_BLUE);
						accountSwitch.Enabled = true;

						this.NavigationItem.SetRightBarButtonItem (accountSwitch, true);
					}

					var spacing = 5.0f;
					var TotalHeaderFrame = new CGRect (0, spacing, View.Frame.Width, 20f);
					var TotalBalanceFrame = new CGRect (0, TotalHeaderFrame.Bottom, View.Frame.Width, 60f);
					var ReturnRateFrame = new CGRect (15f, TotalBalanceFrame.Bottom + 2 * spacing, View.Frame.Width - (15 * 3), 25f);
					var ContributionFrame = new CGRect (15f, ReturnRateFrame.Bottom, View.Frame.Width - (15f * 3), 25f);
					var PortfolioHeaderFrame = new CGRect (15f, ContributionFrame.Bottom + 4 * spacing, (View.Frame.Width / 2), 20f);

					var DashboardControlFrame = new CGRect (PortfolioHeaderFrame.Right, ContributionFrame.Bottom + 4 * spacing, View.Frame.Width - PortfolioHeaderFrame.Width - 25f, 25f);

					var scrollFrame = new CGRect (0, this.NavigationController.NavigationBar.Frame.Height + UIApplication.SharedApplication.StatusBarFrame.Height, View.Frame.Width, View.Frame.Height);
					var chartFrame = new CGRect (0, PortfolioHeaderFrame.Bottom + 3 * spacing, View.Frame.Width, 620f);
					DashboardScrollView = new UIView (scrollFrame);

					var dashboardSegmentControl = new UISegmentedControl (DashboardControlFrame);
					dashboardSegmentControl.TintColor = UIColor.Clear.FromHexString (RSColors.MM_BLUE);
					dashboardSegmentControl.InsertSegment ("List", 0, false);
					dashboardSegmentControl.InsertSegment ("Chart", 1, false);
					dashboardSegmentControl.SelectedSegment = 0;
					dashboardSegmentControl.ControlStyle = UISegmentedControlStyle.Plain;
					dashboardSegmentControl.SetWidth (DashboardControlFrame.Width / 2, 0);
					dashboardSegmentControl.SetWidth (DashboardControlFrame.Width / 2, 1);

					LoadingIndicator.StartAnimating ();

					var currentDashboard = await repo.GetDashboard ();

					var TotalHeader = new UILabel (TotalHeaderFrame) {
						Font = UIFont.SystemFontOfSize (12f),
						TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
						Text = String.Format ("Total Balance as of {0}", Convert.ToDateTime (currentDashboard.totalBalanceValDate).ToString ("MM/dd/yy")),
						TextAlignment = UITextAlignment.Center
					};
	

					var TotalBalance = new UILabel (TotalBalanceFrame) {
						Font = UIFont.BoldSystemFontOfSize (39f),
						TextColor = UIColor.Clear.FromHexString (RSColors.GREEN_4),
						Text = String.Format ("{0:C}", currentDashboard.totalBalance),
						TextAlignment = UITextAlignment.Center,
					};
					

					var divider = new UIView (new CGRect (View.Frame.Left, TotalBalanceFrame.Bottom, View.Frame.Width, 1f)) {
						Alpha = 0.5f,
						BackgroundColor = UIColor.Clear.FromHexString (RSColors.RS_LIGHT_GRAY_2)
					};

					var lblReturnRateInfo = new UILabel (ReturnRateFrame) {
						Font = UIFont.SystemFontOfSize (12f),
						TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
						Text = String.Format ("Rate of Return {0} - {1}", Convert.ToDateTime (currentDashboard.rorStartDate).ToString ("MM/dd/yy"), Convert.ToDateTime (currentDashboard.rorEndDate).ToString ("MM/dd/yy")),
						TextAlignment = UITextAlignment.Left,
						ContentMode = UIViewContentMode.Center
					};

					var lblReturnRateAmount = new UILabel (ReturnRateFrame) {
						Font = UIFont.FromName ("HelveticaNeue-Medium", 12f),
						TextColor = UIColor.Clear.FromHexString (RSColors.GREEN_4),
						Text = String.Format ("{0:P}", currentDashboard.rateOfReturn),
						TextAlignment = UITextAlignment.Right,
						ContentMode = UIViewContentMode.Center
					};

					var lblContributionInfo = new UILabel (ContributionFrame) {
						Font = UIFont.SystemFontOfSize (12f),
						TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
						Text = String.Format ("Last Contrib/Payroll Amt {0}", currentDashboard.lastContributionDate.Trim () != "" ? Convert.ToDateTime (currentDashboard.lastContributionDate).ToString ("MM/dd/yy") : "N/A"),
						TextAlignment = UITextAlignment.Left,
						ContentMode = UIViewContentMode.Center
					};

					var lblContributionAmount = new UILabel (ContributionFrame) {
						Font = UIFont.FromName ("HelveticaNeue-Medium", 12f),
//.........这里部分代码省略.........
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:101,代码来源:RSDashboardViewController.cs

示例4: ViewDidLoad

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


			if (App.authManager.TicketExpired ()) {
				await DialogUtil.ShowAlert ("Session Expired", "Your session has expired. Returning to Login Screen", "OK");
				AppCache.Instance.Ticket = null;
				AppCache.Instance.ClearCache ();
				NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.TouchSwitchClicked.ToString ());
				app.Window.RootViewController = Storyboard.InstantiateViewController("LoginScreen") as TSLoginViewController;
			}

			try
			{
				var repo = new RSContentRepository();
				var dashboardInfo = await repo.GetDashboard();

				this.Title = CatName;

				var scrollFrame = new CGRect (0, this.NavigationController.NavigationBar.Frame.Height + UIApplication.SharedApplication.StatusBarFrame.Height, View.Frame.Width, View.Frame.Height);

				View.BackgroundColor = UIColor.White;

				var spacing = 5.0f;

				var TotalHeaderFrame = new CGRect (0, spacing, View.Frame.Width, 15f);
				var TotalBalanceFrame = new CGRect (0, TotalHeaderFrame.Bottom + spacing , View.Frame.Width, 60f);
				var PortfolioHeaderFrame = new CGRect (15f, TotalBalanceFrame.Bottom + 3 * spacing, (View.Frame.Width/2), 20);
				var PortfolioControlFrame = new CGRect (PortfolioHeaderFrame.Right, TotalBalanceFrame.Bottom + 3 * spacing, View.Frame.Width - PortfolioHeaderFrame.Width - 25f, 25f);

				var chartFrame = new CGRect (0, PortfolioHeaderFrame.Bottom + 3*spacing, View.Frame.Width, 700f);
				ControllerScrollView = new UIView (scrollFrame);

				var portfolioSegmentControl = new UISegmentedControl (PortfolioControlFrame);
				portfolioSegmentControl.TintColor = UIColor.Clear.FromHexString (RSColors.MM_BLUE);
				portfolioSegmentControl.InsertSegment ("List", 0, false);
				portfolioSegmentControl.InsertSegment ("Chart", 1, false);
				portfolioSegmentControl.SelectedSegment = 0;
				portfolioSegmentControl.ControlStyle = UISegmentedControlStyle.Plain;
				portfolioSegmentControl.SetWidth (PortfolioControlFrame.Width/2, 0);
				portfolioSegmentControl.SetWidth (PortfolioControlFrame.Width/2, 1);

				var TotalHeader = new UILabel(TotalHeaderFrame) {
					Font = UIFont.SystemFontOfSize(12f),
					TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
					Text = "Balance",
					//Text = String.Format("{0} Balance", CatName),
					TextAlignment = UITextAlignment.Center
				};

				var CatTotal = dashboardInfo.fundsInfo.funds.Where (x => x.assetCategoryDescripton == CatName).Sum (x =>x.fundBalance);

				var TotalBalance = new UILabel(TotalBalanceFrame) {
					Font = UIFont.BoldSystemFontOfSize(39f),
					TextColor = UIColor.Clear.FromHexString (RSColors.GREEN_4),
					Text = String.Format("{0:C}", CatTotal),
					TextAlignment = UITextAlignment.Center,
				};

				var divider = new UIView(new CGRect(View.Frame.Left, TotalBalanceFrame.Bottom, View.Frame.Width, 1f))
				{
					Alpha = 0.5f,
					BackgroundColor = UIColor.Clear.FromHexString(RSColors.RS_LIGHT_GRAY)
				};

				var PortfolioHeader = new UILabel(PortfolioHeaderFrame) {
					Font = UIFont.SystemFontOfSize(12f),
					TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
					Text = "My Investment by Category",
					TextAlignment = UITextAlignment.Left
				};

				var result = dashboardInfo.fundsInfo.funds.Where (x => x.assetCategoryDescripton == CatName).Select (fc => new GenericChartInput () {
					Name = fc.fundName,
					Amount = fc.fundBalance
				}).ToList();

				var catChartData = new List<IChartInput> ();

				foreach (var gi in result.OrderByDescending(x => x.Amount).ToList()) {
					catChartData.Add (gi);
				}

				chartControl = new CircleChartControl(this);
				chartControl.Data = ChartBuilder.ChartSourceBuilder (catChartData, RSColors.chartColorArray, false);
				chartControl.NavType = NavigationType.Detail;
				chartControl.TableType = TableTypeMode.None;
				chartControl.GraphLineThickness = 16;
				chartControl.Frame = chartFrame;

				tableControl = new CircleChartControl (this);
				tableControl.Data = ChartBuilder.ChartSourceBuilder (catChartData, RSColors.chartColorArray, false);
				tableControl.NavType = NavigationType.Detail;
				tableControl.TableType = TableTypeMode.TableView;
				tableControl.Frame = chartFrame;
				tableControl.ChartTitle = "Fund & Allocation";

				ControllerScrollView.AddSubview (TotalHeader);
				ControllerScrollView.AddSubview (TotalBalance);
//.........这里部分代码省略.........
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:101,代码来源:RSPortfolioViewController.cs

示例5: InitSubviews

		private void InitSubviews ()
		{
			FitpulseTheme.Apply (View);

			scrollView = new UIScrollView (UIScreen.MainScreen.Bounds);
			Add (scrollView);

			if (UISwitch.Appearance.RespondsToSelector (new Selector ("onImage"))) {
			} else {
				bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion (7, 0);
				var onRect = new CGRect (72, 20, 76, 42);
				var offRect = new CGRect (176, 20, 76, 42);

				if (!showSwitchText) {
				  onRect.X += 20;
				  onRect.Width -= 20;
				  offRect.Width -= 20;
				}

				var onSwitch = new SwitchOnOff (onRect);
				onSwitch.SetOn (true);

				var offSwitch = new SwitchOnOff (offRect);
				offSwitch.SetOn (false);

				onSwitch.ShowText (showSwitchText);
				offSwitch.ShowText (showSwitchText);

				scrollView.AddSubviews (onSwitch, offSwitch);
			}

			progressBar = new PercentageProgressBar (new CGRect (20, 68, 280, 24));
			progressBar.Progress = 0.5f;

			scrollView.Add (progressBar);

			var loadingLabel = new UILabel (new CGRect (118, 91, 84, 19));
			loadingLabel.Text = "Loading...";
			loadingLabel.Font = UIFont.BoldSystemFontOfSize (15);
			loadingLabel.TextColor = UIColor.FromRGB (135, 141, 138);
			loadingLabel.BackgroundColor = UIColor.Clear;
			loadingLabel.TextAlignment = UITextAlignment.Center;

			scrollView.Add (loadingLabel);		

			slider = new UISlider (new CGRect (18, 121, 284, 23));
			slider.MinValue = 0;
			slider.MaxValue = 1;
			slider.Value = 0.5f;
			slider.ValueChanged += (sender, e) => {
				progressBar.Progress = slider.Value; };

			scrollView.Add (slider);	

			var uiSegmentedControl = new UISegmentedControl (new [] {"Yes", "No", "Maybe"}) {
				SelectedSegment = 0
			};

			FitpulseTheme.Apply (uiSegmentedControl);
			uiSegmentedControl.SetWidth (80.0f, 0);
			uiSegmentedControl.SetWidth (80.0f, 1);				
			
			uiSegmentedControl.Frame = new CGRect (26, 161, 268, 44);

			scrollView.Add (uiSegmentedControl);

			textField = new UITextField (new CGRect (20, 221, 280, 31));
			textField.LeftView = new UIView (new CGRect (0, 0, 5, 31));
			textField.LeftViewMode = UITextFieldViewMode.Always;
			textField.Font = UIFont.SystemFontOfSize (14);
			textField.TextColor = UIColor.White;
			textField.Background = UIImage.FromFile ("text-input.png");
			textField.VerticalAlignment = UIControlContentVerticalAlignment.Center;
			textField.Placeholder = "Text";
			FitpulseTheme.Apply (textField);

			textField.Delegate = new TextFieldDelegate ();

			scrollView.Add (textField);

			var leftTopButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.GrayButtonImage);
			var rightTopButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.GrayPressedButtonImage);

			var leftBottomButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.BlueButtonImage);
			var rightBottomButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.BluePressedButtonImage);

			leftBottomButton.SetTitleColor (UIColor.White, UIControlState.Normal);
			leftBottomButton.SetTitleColor (UIColor.DarkGray, UIControlState.Highlighted);
			rightBottomButton.SetTitleColor (UIColor.White, UIControlState.Normal);
			rightBottomButton.SetTitleColor (UIColor.DarkGray, UIControlState.Highlighted);

			leftBottomButton.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
			leftBottomButton.SetTitleShadowColor (UIColor.Gray, UIControlState.Highlighted);
			rightBottomButton.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
			rightBottomButton.SetTitleShadowColor (UIColor.Gray, UIControlState.Highlighted);

			leftTopButton.Frame = new CGRect (20, 268, 126, 42);
			leftBottomButton.Frame = new CGRect (20, 318, 126, 42);
			rightTopButton.Frame = new CGRect (174, 268, 126, 42);
			rightBottomButton.Frame = new CGRect (174, 318, 126, 42);
//.........这里部分代码省略.........
开发者ID:sakr2015,项目名称:eforsah_v1.1,代码行数:101,代码来源:ElementsViewController.cs


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