• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UISegmentedControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CommitView

        public CommitView()
        {
			_viewSegment = new UISegmentedControl(new [] { "Changes", "Comments", "Approvals" });
			_viewSegment.SelectedSegment = 0;
			_viewSegment.ValueChanged += (sender, e) => Render();
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:7,代码来源:CommitView.cs


示例2: ViewDidAppear

        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            this.View.BackgroundColor = UIColor.LightGray;

            txtSpeak = new UITextView (new RectangleF (20, 50, this.View.Bounds.Width - 40, 100));
            txtSpeak.Text = "Xamarin rocks!";
            this.View.AddSubview (txtSpeak);

            segAccent = new UISegmentedControl (new string[] {"US", "UK", "AUS" });
            segAccent.Frame = new RectangleF(20,160,this.View.Bounds.Width - 40, 50);
            segAccent.SelectedSegment = 0;
            this.View.AddSubview (segAccent);

            lblRate = new UILabel (new RectangleF (20, 230, 200, 20));
            lblRate.Text = "Rate";
            this.View.AddSubview (lblRate);

            sldRate = new UISlider(new RectangleF(20,250,this.View.Bounds.Width - 40, 50));
            sldRate.MinValue = 0;
            sldRate.MaxValue = 100;
            sldRate.Value = 75;

            this.View.AddSubview (sldRate);

            lblPitch = new UILabel (new RectangleF (20, 305, 200, 20));
            lblPitch.Text = "Pitch";
            this.View.AddSubview (lblPitch);

            sldPitch = new UISlider(new RectangleF(20,325,this.View.Bounds.Width - 40, 50));

            sldPitch.MinValue = 0;
            sldPitch.MaxValue = 100;
            sldPitch.Value = 75;

            this.View.AddSubview (sldPitch);

            btnSpeak = new UIButton (UIButtonType.RoundedRect);
            btnSpeak.Frame = new RectangleF (100, 375, this.View.Bounds.Width - 200, 30);
            btnSpeak.SetTitle ("Speak", UIControlState.Normal);

            btnSpeak.TouchDown += (object sender, EventArgs e) => {
                var speechSynthesizer = new AVSpeechSynthesizer ();
                var speechUtterance =
                    new AVSpeechUtterance (txtSpeak.Text);
                string lang = "en-US";

                if (segAccent.SelectedSegment == 1) lang = "en-GB";
                if (segAccent.SelectedSegment == 2) lang = "en-AU";

                speechUtterance.Voice = AVSpeechSynthesisVoice.FromLanguage (lang);
                speechUtterance.Rate = AVSpeechUtterance.MaximumSpeechRate * (sldRate.Value / 100);
                speechUtterance.PitchMultiplier = 2.0f * (sldPitch.Value / 100);

                speechSynthesizer.SpeakUtterance (speechUtterance);
            };

            this.View.AddSubview (btnSpeak);
        }
开发者ID:jawbrey,项目名称:Code-ios7,代码行数:60,代码来源:SpeechToTextController.cs


示例3: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			sc = new UISegmentedControl () {
				BackgroundColor = UIColor.Clear,
				Tag = 1,
			};
			sc.Selected = true;

			sc.InsertSegment (choices [0].Text, 0, false);
			sc.InsertSegment (choices [1].Text, 1, false);
			sc.Frame = new RectangleF (570f, 8f, 150f, 26f);

			sc.SelectedSegment = choices.FindIndex (e => e.Id == val.Id);
			sc.AddTarget (delegate {
				Value = choices [sc.SelectedSegment];
			}, UIControlEvent.ValueChanged);

			var cell = tv.DequeueReusableCell (CellKey);
//			if (cell == null) {
				cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
				cell.AddSubview (sc);
//			} 
//			else
//				RemoveTag (cell, 1);
			cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (17);
			//cell.Frame.Height = 44;
			cell.TextLabel.Text = Caption;
			if (this.IsMandatory)
				cell.TextLabel.Text += "*";
			

			return cell;
		}
开发者ID:ClusterReplyBUS,项目名称:MonoTouch.Dialog,代码行数:34,代码来源:TwoStateElement.cs


示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            this.View.BackgroundColor = UIColor.LightGray;

            guid = new NSUuid ("c5cf54e0-6dd8-45e9-91a3-a8cda2f41120");
            bRegion = new CLBeaconRegion (guid, "beacon");

            bRegion.NotifyEntryStateOnDisplay = true;
            bRegion.NotifyOnEntry = true;
            bRegion.NotifyOnExit = true;

            base.ViewDidLoad ();

            segBeacon = new UISegmentedControl (new string[] { "Beacon", "Finder" });
            segBeacon.Frame = new RectangleF (20, 50, this.View.Bounds.Width - 40, 50);
            segBeacon.SelectedSegment = 0;

            button = new UIButton (UIButtonType.RoundedRect);
            button.SetTitle ("Start!", UIControlState.Normal);
            button.Frame = new RectangleF (50, 150, this.View.Bounds.Width - 100, 30);

            button.TouchDown += HandleTouchDown;
            this.View.AddSubview (segBeacon);
            this.View.AddSubview (button);
        }
开发者ID:jawbrey,项目名称:Code-ios7,代码行数:25,代码来源:BeaconController.cs


示例5: Initialize

		private void Initialize ()
		{
			Title = Locale.GetText ("");
			_mapView = new MKMapView ();
			_mapView.AutoresizingMask = UIViewAutoresizing.All;
			_mapView.MapType = MKMapType.Standard;
			_mapView.ShowsUserLocation = true;
			
			_sgMapType = new UISegmentedControl ();
			_sgMapType.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			_sgMapType.Opaque = true;
			_sgMapType.Alpha = 0.75f;
			_sgMapType.ControlStyle = UISegmentedControlStyle.Bar;
			_sgMapType.InsertSegment ("Map", 0, true);
			_sgMapType.InsertSegment ("Satellite", 1, true);
			_sgMapType.InsertSegment ("Hybrid", 2, true);
			_sgMapType.SelectedSegment = 0;
			_sgMapType.ValueChanged += (s, e) => {
				switch (_sgMapType.SelectedSegment) {
				case 0:
					_mapView.MapType = MKMapType.Standard;
					break;
				case 1:
					_mapView.MapType = MKMapType.Satellite;
					break;
				case 2:
					_mapView.MapType = MKMapType.Hybrid;
					break;
				}
			};
		}
开发者ID:bpug,项目名称:LbkIos,代码行数:31,代码来源:LbkMapViewController.cs


示例6: FinishedLaunching

		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			CGRect rect = UIScreen.MainScreen.ApplicationFrame;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new CGRect (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			var images = new[] {
				UIImage.FromFile ("Images/Red.png"),
				UIImage.FromFile ("Images/Yellow.png"),
				UIImage.FromFile ("Images/Green.png"),
				UIImage.FromFile ("Images/Blue.png"),
				UIImage.FromFile ("Images/Purple.png")
			};
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				// we want the original colors, which is not the default iOS7 behaviour, so we need to
				// replace them with ones having the right UIImageRenderingMode
				for (int i = 0; i < images.Length; i++)
					images [i] = images [i].ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
			}
			var segmentedControl = new UISegmentedControl (images);

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			var frame = new CGRect (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
			// Set the color using OpenGL
			GL.Color4 (r, g, b, PaintingView.BrushOpacity);

			// Look in the Info.plist file and you'll see the status bar is hidden
			// Set the style to black so it matches the background of the application
			app.SetStatusBarStyle (UIStatusBarStyle.BlackTranslucent, false);
			// Now show the status bar, but animate to the style.
			app.SetStatusBarHidden (false, true);

			//Configure and enable the accelerometer
			UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
			UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;

			window.MakeKeyAndVisible ();

			return true;
		}
开发者ID:g7steve,项目名称:monotouch-samples,代码行数:61,代码来源:Main.cs


示例7: ToolbarConfigurationItem

		public UIBarButtonItem ToolbarConfigurationItem()
		{
			var current = model.Ordering;
			
			toolbarControl = new UISegmentedControl();
			toolbarControl.InsertSegment("name", 0, false);
			toolbarControl.InsertSegment("time", 1, false);
			toolbarControl.SelectedSegment = (current == BuildOrder.BuildName) ? 0 : 1;
			toolbarControl.ControlStyle = UISegmentedControlStyle.Bar;
			toolbarControl.Frame = new System.Drawing.RectangleF(0, 10, 100, 30);
			toolbarControl.UserInteractionEnabled = true;
			
			toolbarControl.ValueChanged += delegate {
				switch (toolbarControl.SelectedSegment) {
				case 0:
					model.Ordering = BuildOrder.BuildName;
					break;
				default:
					model.Ordering = BuildOrder.BuildTime;
					break;
				}
				InvokeOnMainThread(UpdateUI);
			};
			
			return new UIBarButtonItem(toolbarControl);
		}
开发者ID:Smeedee,项目名称:Smeedee-Mobile,代码行数:26,代码来源:BuildStatusWidget.xib.cs


示例8: ViewDidLoad

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

			var camera = CameraPosition.FromCamera (37.78318, -122.403874, 18);
			mapView = MapView.FromCamera (CGRect.Empty, camera);
			mapView.BuildingsEnabled = false;
			View = mapView;

			// The possible floors that might be shown.
			var types = new [] { "1", "2", "3" };

			// Create a UISegmentedControl that is the navigationItem's titleView.
			switcher = new UISegmentedControl (types) {
				SelectedSegment = 0,
				ControlStyle = UISegmentedControlStyle.Bar,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
			};

			NavigationItem.TitleView = switcher;

			// Listen to touch events on the UISegmentedControl, force initial update.
			switcher.ValueChanged += DidChangeSwitcher;

			DidChangeSwitcher ();
		}
开发者ID:asthanarht,项目名称:XamarinDiscountsApp,代码行数:26,代码来源:TileLayerViewController.cs


示例9: ViewDidLoad

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

            View.BackgroundColor = CashflowTheme.SharedTheme.ViewBackground;

            RCSwitchOnOff onSwitch = new RCSwitchOnOff (new RectangleF(72, 50, 76, 33));
            onSwitch.IsOn = true;
            scrollView.AddSubview (onSwitch);

            RCSwitchOnOff offSwitch = new RCSwitchOnOff (new RectangleF(176, 50, 76, 33));
            offSwitch.IsOn = false;
            scrollView.AddSubview (offSwitch);

            progressBar = new ADVPopoverProgressBar (new RectangleF(20, 135, 280, 23));
            progressBar.SetProgress (0.5f);
            scrollView.AddSubview (progressBar);

            UISegmentedControl segment = new UISegmentedControl (new object[] {"Yes", "No"});
            segment.Frame = new RectangleF (85, 245, 150, 42);
            segment.SelectedSegment = 0;

            scrollView.AddSubview (segment);

            imageViewBg.Image = UIImage.FromFile ("Images/iPhone/black/revisions-bg.png").CreateResizableImage (
                new UIEdgeInsets (50, 10, 200, 10));
        }
开发者ID:alleeclark,项目名称:morganHack,代码行数:27,代码来源:UIElementsViewController.cs


示例10: CreateSegmentedControl

        void CreateSegmentedControl ()
        {
//            _segmentedControl = new UISegmentedControl (new object[] { "one", "two", "three", "four" });
//            _segmentedControl.ControlStyle = UISegmentedControlStyle.Bezeled;
//            _segmentedControl.TintColor = UIColor.Black;
//            _segmentedControl.SetImage (UIImage.FromFile ("Star.png"), 0);
//            _segmentedControl.SelectedSegment = 0;
//            _segmentedControl.Frame = new RectangleF (10, 10, View.Frame.Width - 20, 50);
            
            _testLabel = new UILabel { Frame = new RectangleF (10, 200, 100, 50) };
            
            _segmentedControl = new UISegmentedControl (new object[] { UIImage.FromFile ("Star.png"), "two", "three", "four" });
            _segmentedControl.ControlStyle = UISegmentedControlStyle.Bezeled;
            _segmentedControl.TintColor = UIColor.Black;
            _segmentedControl.Frame = new RectangleF (10, 10, View.Frame.Width - 20, 50);
            
            _segmentedControl.ValueChanged += (o, e) =>
            {
                _text = _segmentedControl.TitleAt (_segmentedControl.SelectedSegment) ?? "title not set";
                _testLabel.Text = _text;
            };
            
            _segmentedControl.SelectedSegment = 0;
            _segmentedControl.AddSubview (_testLabel);
            
            View.AddSubview (_segmentedControl);
        }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:27,代码来源:ControlDemoViewController.xib.cs


示例11: ToolbarConfigurationItem

		public UIBarButtonItem ToolbarConfigurationItem()
		{
			var current = model.TimePeriod;
			
			toolbarControl = new UISegmentedControl();
			toolbarControl.InsertSegment("24h", 0, false);
			toolbarControl.InsertSegment("week", 1, false);
			toolbarControl.InsertSegment("month", 2, false);
			toolbarControl.SelectedSegment = (current == TimePeriod.PastDay) ? 0 : (current == TimePeriod.PastWeek) ? 1 : 2;
			toolbarControl.ControlStyle = UISegmentedControlStyle.Bar;
			toolbarControl.Frame = new System.Drawing.RectangleF(0, 10, 130, 30);
			toolbarControl.UserInteractionEnabled = true;
			
			toolbarControl.ValueChanged += delegate {
				switch (toolbarControl.SelectedSegment) {
				case 0:
					model.TimePeriod = TimePeriod.PastDay;
					break;
				case 1:
					model.TimePeriod = TimePeriod.PastWeek;
					break;
				default:
					model.TimePeriod = TimePeriod.PastMonth;
					break;
				}
				ViewWillAppear(true);
			};
			
			return new UIBarButtonItem(toolbarControl);
		}
开发者ID:Smeedee,项目名称:Smeedee-Mobile,代码行数:30,代码来源:TopCommittersWidget.xib.cs


示例12: BuildControlsDialogViewController

        DialogViewController BuildControlsDialogViewController()
        {
            var segmentControl = new UISegmentedControl (new string[] {
                "One", "Two", "Three"
            });
            segmentControl.Frame = new RectangleF (5, 5, 280, 35);

            segmentControl.SetEnabled (true, 1);

            var root = new BTRootElement ("Controls Dialog View Controller") {
                new BTBackgroundImageSection("Controls")
                {
                    new FloatElement(Resources.TempIcon, Resources.TempIcon, 0.5f),
                    WrapInView(new UIProgressView (new RectangleF (10, 20, 280, 18)) { Progress = 0.75f }),
                    new ActivityElement(),
                    //new BadgeElement("")
                    new BooleanElement("Boolean Element", true),
                    //new BTBooleanElement("BTBooleanElement", true),
                    //new BooleanImageElement("BoolImage", true, //)

                    WrapInView (segmentControl),

                }
            };

            return new BTDialogViewController (root, false);
        }
开发者ID:rmawani,项目名称:themesystem,代码行数:27,代码来源:AppDelegate.cs


示例13: ViewDidLoad

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

			_viewSegment = new UISegmentedControl(new object[] { "Open".t(), "Closed".t(), "Custom".t() });
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
            _segmentBarButton.Width = View.Frame.Width - 10f;
			ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
			var vm = (MyIssuesViewModel)ViewModel;
			vm.Bind(x => x.SelectedFilter, x =>
			{
				if (x == 2)
				{
					ShowFilterController(new CodeHub.iOS.Views.Filters.MyIssuesFilterViewController(vm.Issues));
				}

                // If there is searching going on. Finish it.
                FinishSearch();
			});

			BindCollection(vm.Issues, CreateElement);
			var set = this.CreateBindingSet<MyIssuesView, MyIssuesViewModel>();
			set.Bind(_viewSegment).To(x => x.SelectedFilter);
			set.Apply();
        }
开发者ID:ryanseys,项目名称:CodeHub,代码行数:25,代码来源:MyIssuesView.cs


示例14: Styles

		public Styles()
		{
			this.SfGrid = new SfDataGrid ();
			viewmodel = new GridGettingStartedViewModel ();
			this.SfGrid.AutoGeneratingColumn += GridAutoGenerateColumns;
			this.SfGrid.ItemsSource = viewmodel.OrdersInfo;
			this.SfGrid.ShowRowHeader = false;
			this.SfGrid.HeaderRowHeight = 45;
			this.SfGrid.RowHeight = 45;
			this.SfGrid.SelectionMode = SelectionMode.Multiple;
			this.SfGrid.GridViewCreated += SfGrid_GridViewCreated;
			this.SfGrid.GroupColumnDescriptions.Add (new GroupColumnDescription(){ColumnName ="CustomerID"});
			this.SfGrid.AlternatingRowColor = UIColor.FromRGB (25, 25, 25);
			segmentControl = new UISegmentedControl();
			segmentControl.ControlStyle = UISegmentedControlStyle.Bezeled;
			segmentControl.InsertSegment("Dark", 0,true);
			segmentControl.InsertSegment("Blue", 1, true);
			segmentControl.InsertSegment("Red", 2, true);
			segmentControl.InsertSegment("Green", 3, true);
			segmentControl.SelectedSegment = 0;
			segmentControl.ValueChanged += SegmentControl_ValueChanged;
			this.control = this;
			this.AddSubview (segmentControl);
			this.AddSubview (SfGrid);
		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:25,代码来源:Styles.cs


示例15: ViewDidLoad

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

            _tipLabel = new UILabel ();
            _calculateButton = new UIButton (UIButtonType.Custom);
            _priceField = new UITextField ();
            _tipPercentages = new UISegmentedControl ();

            View.AddSubview (_priceField);
            View.AddSubview (_calculateButton);
            View.AddSubview (_tipLabel);
            View.AddSubview (_tipPercentages);

            _priceField.TranslatesAutoresizingMaskIntoConstraints = false;
            _priceField.KeyboardType = UIKeyboardType.DecimalPad;
            _priceField.BorderStyle = UITextBorderStyle.RoundedRect;
            _priceField.Placeholder = "Enter Total Amount:";

            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.TopMargin, 1, -28));
            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.CenterX, 1, 0));
            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.Width, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.Width, 1, 40));
            View.AddConstraint (NSLayoutConstraint.Create (_priceField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 35));

            _calculateButton.TranslatesAutoresizingMaskIntoConstraints = false;
            _calculateButton.SetTitle ("Calculate", UIControlState.Normal);
            _calculateButton.SetTitleColor (UIColor.White, UIControlState.Normal);
            _calculateButton.SetTitleColor (UIColor.Blue, UIControlState.Highlighted);
            _calculateButton.BackgroundColor = UIColor.Green;
            _calculateButton.TouchUpInside += (sender, e) => CalculateCurrentTip();

            View.AddConstraint(NSLayoutConstraint.Create(_priceField, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _calculateButton, NSLayoutAttribute.Top, 1, -8));
            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));
            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));

            _tipPercentages.TranslatesAutoresizingMaskIntoConstraints = false;
            _tipPercentages.InsertSegment ("10%", 0, false);
            _tipPercentages.InsertSegment ("15%", 1, false);
            _tipPercentages.InsertSegment ("20%", 2, false);
            _tipPercentages.InsertSegment ("25%", 3, false);
            _tipPercentages.SelectedSegment = 2;
            _tipPercentages.ValueChanged += (sender, e) => CalculateCurrentTip();

            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _tipPercentages, NSLayoutAttribute.Top, 1, -8));
            View.AddConstraint (NSLayoutConstraint.Create (_tipPercentages, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));
            View.AddConstraint (NSLayoutConstraint.Create (_tipPercentages, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));

            _tipLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _tipLabel.TextColor = UIColor.Blue;
            _tipLabel.Text = string.Format (TipFormat, 0);
            _tipLabel.TextAlignment = UITextAlignment.Center;

            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _tipPercentages, NSLayoutAttribute.Bottom, 1, 8));
            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));
            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));

            View.BackgroundColor = UIColor.Yellow;
            View.AddGestureRecognizer (new UITapGestureRecognizer (() => _priceField.ResignFirstResponder ()));
        }
开发者ID:dylansturg,项目名称:XamarinUniversitySamples,代码行数:59,代码来源:TipCalculatorViewController.cs


示例16: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			refreshControl = new UIRefreshControl ();
			refreshControl.BackgroundColor = UIColor.White;
			refreshControl.TintColor = UIColor.Black;
			refreshControl.AddTarget(refreshTableHandler, UIControlEvent.ValueChanged);
			tableView.AddSubview (refreshControl);

			if (!isFromePeekViewController) {
				this.NavigationController.NavigationBar.Hidden =  false;
				this.NavigationController.NavigationBar.TintColor = UIColor.White;
				this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(44/255f,146/255f,208/255f);
				this.NavigationController.NavigationBar.BarStyle = UIBarStyle.Black;

				this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes (){
					ForegroundColor = UIColor.White,
					Font = UIFont.FromName("System Bold",20.0f)
				};
				this.NavigationItem.SetRightBarButtonItem (new UIBarButtonItem(
					UIImage.FromFile("btn_nav_edit.png"), UIBarButtonItemStyle.Plain, (sender, args) => {
						sendSipperViewController sendSipperVC = new sendSipperViewController();
						sendSipperVC.HidesBottomBarWhenPushed =  true;
						this.NavigationController.PushViewController(sendSipperVC,true );
					}), true);
			}

			string[] tab = new string[]{"New","Hot"};
			segmentControll = new UISegmentedControl(tab);
			segmentControll.Frame = new CGRect (0,0,123,29);
			segmentControll.ControlStyle = UISegmentedControlStyle.Bordered;
			segmentControll.SelectedSegment = 0;
			segmentControll.ValueChanged += (sender, e) => {
				var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;
				Console.WriteLine("selectedSegmentId : {0}",segmentControll.SelectedSegment);
				if (isFromePeekViewController) {
					GetSippsByPeekAsync (peekId);
				} else {
					getSippList();
				}
			};
			this.NavigationItem.TitleView = segmentControll;
			tableView.SeparatorInset =  new UIEdgeInsets(0,0,0,20);

			SwitchImageView.Image = UIImage.FromFile ("img_seg_new.png");
			btn_New.TouchUpInside += (object sender, EventArgs e) => {
				SwitchImageView.Image = UIImage.FromFile ("img_seg_new.png");
			};

			btn_Hot.TouchUpInside += (object sender, EventArgs e) => {
				SwitchImageView.Image = UIImage.FromFile ("img_seg_hot.png");
			};


			btn_sendSipper.TouchUpInside += (object sender, EventArgs e) => {

			};

		}
开发者ID:ppkdo,项目名称:sipper,代码行数:59,代码来源:HomeScreenVC.cs


示例17: ViewDidLoad

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

            Title = "Mi Ubicacion";

            mapView = new MKMapView(View.Bounds);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            //mapView.MapType = MKMapType.Standard;	// this is the default
            //mapView.MapType = MKMapType.Satellite;
            mapView.MapType = MKMapType.Hybrid;
            mapView.ZoomEnabled = true;
            View.AddSubview(mapView);

            // this is all that's required to show the blue dot indicating user-location
            mapView.ShowsUserLocation = true;

            Console.WriteLine ("initial loc:"+mapView.UserLocation.Coordinate.Latitude + "," + mapView.UserLocation.Coordinate.Longitude);

            mapView.DidUpdateUserLocation += (sender, e) => {
                if (mapView.UserLocation != null) {
                    Console.WriteLine ("userloc:"+mapView.UserLocation.Coordinate.Latitude + "," + mapView.UserLocation.Coordinate.Longitude);
                    CLLocationCoordinate2D coords = mapView.UserLocation.Coordinate;
                    MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(1), MilesToLongitudeDegrees(1, coords.Latitude));
                    mapView.Region = new MKCoordinateRegion(coords, span);
                }
            };

            if (!mapView.UserLocationVisible) {
                // user denied permission, or device doesn't have GPS/location ability
                Console.WriteLine ("userloc not visible, show cupertino");
                CLLocationCoordinate2D coords = new CLLocationCoordinate2D(37.33233141,-122.0312186); // cupertino
                MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(20), MilesToLongitudeDegrees(20, coords.Latitude));
                mapView.Region = new MKCoordinateRegion(coords, span);
            }

            int typesWidth=260, typesHeight=30, distanceFromBottom=60;
            mapTypes = new UISegmentedControl(new RectangleF((View.Bounds.Width-typesWidth)/2, View.Bounds.Height-distanceFromBottom, typesWidth, typesHeight));
            mapTypes.InsertSegment("Mapa", 0, false);
            mapTypes.InsertSegment("Satelite", 1, false);
            mapTypes.InsertSegment("Hibrido", 2, false);
            mapTypes.SelectedSegment = 0; // Road is the default
            mapTypes.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
            mapTypes.ValueChanged += (s, e) => {
                switch(mapTypes.SelectedSegment) {
                case 0:
                    mapView.MapType = MKMapType.Standard;
                    break;
                case 1:
                    mapView.MapType = MKMapType.Satellite;
                    break;
                case 2:
                    mapView.MapType = MKMapType.Hybrid;
                    break;
                }
            };

            View.AddSubview(mapTypes);
        }
开发者ID:saedaes,项目名称:gestion2013,代码行数:59,代码来源:MapViewController.cs


示例18: NotificationsView

        public NotificationsView()
        {
            _viewSegment = new UISegmentedControl(new object[] { "Unread", "Participating", "All" });
            _segmentBarButton = new UIBarButtonItem(_viewSegment);

            EmptyView = new Lazy<UIView>(() =>
                new EmptyListView(Octicon.Inbox.ToEmptyListImage(), "No new notifications."));
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:8,代码来源:NotificationsView.cs


示例19: SegmentedControlDidChanged

		partial void SegmentedControlDidChanged (UISegmentedControl sender)
		{
			GraphView newView = graphs [(int)sender.SelectedSegment];
			primaryGraph.RemoveFromSuperview ();
			View.AddSubview (newView);
			primaryGraph = newView;
			primaryGraphLabel.Text = graphTitles [(int)sender.SelectedSegment];
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:8,代码来源:GraphViewController.cs


示例20: FinishedLaunching

		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

			window.BackgroundColor = UIColor.Black;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new RectangleF (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			UISegmentedControl segmentedControl = new UISegmentedControl (new[]{
					UIImage.FromFile ("Images/Red.png"),
					UIImage.FromFile ("Images/Yellow.png"),
					UIImage.FromFile ("Images/Green.png"),
					UIImage.FromFile ("Images/Blue.png"),
					UIImage.FromFile ("Images/Purple.png"),
			});

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			RectangleF frame = new RectangleF (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			segmentedControl.ControlStyle = UISegmentedControlStyle.Bar;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
			// Set the color using OpenGL
			GL.Color4 (r, g, b, PaintingView.BrushOpacity);

			
			// Look in the Info.plist file and you'll see the status bar is hidden
			// Set the style to black so it matches the background of the application
			app.SetStatusBarStyle (UIStatusBarStyle.BlackTranslucent, false);
			// Now show the status bar, but animate to the style.
			app.SetStatusBarHidden (false, true);

			//Configure and enable the accelerometer
			UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
			UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;
			
			//Show the window
			window.MakeKeyAndVisible ();
	
			return true;
		}
开发者ID:rojepp,项目名称:monotouch-samples,代码行数:59,代码来源:Main.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UISlider类代码示例发布时间:2022-05-24
下一篇:
C# UISearchBar类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap