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


C# UISwitch.AddTarget方法代码示例

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


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

示例1: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			if (sw == null){
				sw = new UISwitch (){
					BackgroundColor = UIColor.Clear,
					Tag = 1,
					On = Value
				};
				sw.AddTarget (delegate {
					Value = sw.On;
				}, UIControlEvent.ValueChanged);
			} else
				sw.On = Value;
			
			var cell = tv.DequeueReusableCell (CellKey);
			if (cell == null){
				cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
			} else
				RemoveTag (cell, 1);
		
			cell.TextLabel.Text = Caption;
			cell.AccessoryView = sw;

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

示例2: GetCell

        public override UITableViewCell GetCell(UITableView tv)
        {
            if (_switch == null)
            {
                _switch = new UISwitch
                {
                    BackgroundColor = UIColor.Clear,
                    Tag = 1,
                    On = Value
                };
                _switch.AddTarget(delegate
                {
                    Value = _switch.On;
                }, UIControlEvent.ValueChanged);
            }
            else
            {
                _switch.On = Value;
            }

            var cell = tv.DequeueReusableCell ("boolean_element");
            if (cell == null){
                cell = new UITableViewCell (UITableViewCellStyle.Default, "boolean_element");
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            }

            cell.BackgroundColor = StringElement.BgColor;
            cell.TextLabel.Font = StringElement.DefaultTitleFont.WithSize(StringElement.DefaultTitleFont.PointSize);
            cell.TextLabel.TextColor = StringElement.DefaultTitleColor;
            cell.TextLabel.Text = Caption;
            cell.AccessoryView = _switch;
            return cell;
        }
开发者ID:memopower,项目名称:RepoStumble,代码行数:33,代码来源:TrueFalseElement.cs

示例3: prepareCell

		private void prepareCell(){
			_switch = new UISwitch (){
				BackgroundColor = UIColor.Clear
			};
			_switch.AddTarget (delegate {
				_element.Value = _switch.On;
			}, UIControlEvent.ValueChanged);
			
			AccessoryView = _switch;
		}
开发者ID:escoz,项目名称:MonoMobile.Forms,代码行数:10,代码来源:BooleanElementCell.cs

示例4: InitializeContent

//		public BooleanElement(RectangleF frame) : this("")
//		{
//			Frame = frame;
//		}
		
		public override void InitializeContent()
		{
			if (Switch == null)
			{
				Switch = new UISwitch { BackgroundColor = UIColor.Clear, Tag = 1 };
				
				Switch.AddTarget(delegate { DataBinding.UpdateDataContext(); }, UIControlEvent.ValueChanged);
			}
			
			Cell.AccessoryView = Switch;
		}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:16,代码来源:BooleanElement.cs

示例5: InitializeCell

		public override void InitializeCell(UITableView tableView)
		{
			RemoveTag(1);
			if (Switch == null)
			{
				Switch = new UISwitch { BackgroundColor = UIColor.Clear, Tag = 1, On = Value };
				Switch.AddTarget(delegate
				{
					Value = Switch.On;
				}, UIControlEvent.ValueChanged);
			}

			Cell.TextLabel.Text = Caption;
			Cell.AccessoryView = Switch;
		}
开发者ID:briandonahue,项目名称:MonoTouch.MVVM,代码行数:15,代码来源:BooleanElement.cs

示例6: GetCell

        public override UITableViewCell GetCell(UITableView tv)
        {
            if (sw == null){
                sw = new UISwitch (new RectangleF (198, 12, 94, 27)){
                    BackgroundColor = UIColor.Clear,
                    Tag = 1,
                    On = Value
                };
                sw.AddTarget (delegate {
                    Value = sw.On;
                }, UIControlEvent.ValueChanged);
            }

            var cell = tv.DequeueReusableCell (bkey);
            if (cell == null){
                cell = new UITableViewCell (UITableViewCellStyle.Default, bkey);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            } else
                RemoveTag (cell, 1);

            cell.TextLabel.Text = Caption;
            cell.ContentView.AddSubview (sw);

            return cell;
        }
开发者ID:mauropm,项目名称:Monospace11,代码行数:25,代码来源:Elements.cs

示例7: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			// screen right edge to switch right edge (aligns with accessory) switch is for iPad / iPhone
			int rightPadding = tv.Frame.Width <= 480 ? 30 : 100;
			
			if (sw == null) {
				sw = new UISwitch (new RectangleF (198, 12, 94, 27)) {
					BackgroundColor = UIColor.Clear,
					Tag = 1,
					On = Value
				};
				sw.AddTarget (delegate {
					Value = sw.On;
				}, UIControlEvent.ValueChanged);
			}
			
			var cell = tv.DequeueReusableCell (bkey);
			if (cell == null) {
				cell = new UITableViewCell (UITableViewCellStyle.Default, bkey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
			} else
				RemoveTag (cell, 1);
		
			cell.TextLabel.Text = Caption;
			
			var switchLeft = tv.Frame.Width - sw.Frame.Width - rightPadding;
			var switchTop = (cell.ContentView.Frame.Height - sw.Frame.Height) / 2;
			sw.Frame = new RectangleF (switchLeft, switchTop, sw.Frame.Width, sw.Frame.Height);
			
			cell.ContentView.AddSubview (sw);

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

示例8: GetCell

        public override UITableViewCell GetCell(UITableView tv)
        {
            if (sw == null) {
                sw = new UISwitch () {
                    BackgroundColor = UIColor.Clear,
                    Tag = 1,
                    On = Value
                };
                sw.AddTarget (SwitchChanged, UIControlEvent.ValueChanged);
            } else
                sw.On = Value;

            var cell = tv.DequeueReusableCell (bkey) ?? new UITableViewCell (UITableViewCellStyle.Subtitle, bkey) {
                SelectionStyle = UITableViewCellSelectionStyle.None
            };

            cell.TextLabel.Text = Caption;
            cell.TextLabel.TextColor = TextColor;
            cell.AccessoryView = sw;

            return cell;
        }
开发者ID:Clancey,项目名称:SimpleTables,代码行数:22,代码来源:BoolCell.cs


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