本文整理汇总了C#中UISwitch类的典型用法代码示例。如果您正苦于以下问题:C# UISwitch类的具体用法?C# UISwitch怎么用?C# UISwitch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UISwitch类属于命名空间,在下文中一共展示了UISwitch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Perform any additional setup after loading the view, typically from a nib.
List<string> DataSourceList = new List<string> () {"itme1", "itme2", "itme3",
"itme4", "itme5", "itme6", "itme7","itme8", "itme9", "itme10", "itme11"
};
this.myTableView.Source = new CustomerDataSource (DataSourceList);
List<string> titleList = new List<string> (){ "A-Z", "a-z", "0-9","I-VVI" };
List<string> Alist = new List<string> (){ "A", "B", "C", "D", "E" };
List<string> NumList = new List<string> (){ "0", "1", "2", "3", "4" };
List<string> MIList = new List<string> (){ "I", "II", "III", "VI", "VII" };
this.customerStyleTableView = new UITableView (new CoreGraphics.CGRect (300, 50, 200, 600), UITableViewStyle.Grouped);
this.customerStyleTableView.Source = new CustomerGroupSource (titleList, Alist, NumList,MIList);
this.View.AddSubview(this.customerStyleTableView);
this.customerAccessory = new UITableView (new CoreGraphics.CGRect (600, 50, 400, 600), UITableViewStyle.Grouped);
this.customerAccessory.Source = new CustomerGroupSource (titleList, Alist, NumList,MIList);
this.View.AddSubview (this.customerAccessory);
usw = new UISwitch (new CoreGraphics.CGRect (820, 50, 50, 20));
usw.ValueChanged += CSw_ValueChange;
this.View.AddSubview (usw);
}
示例2: BooleanCellView
public BooleanCellView()
: base(UITableViewCellStyle.Default, "boolean_element")
{
Switch = new UISwitch();
Switch.BackgroundColor = UIColor.Clear;
SelectionStyle = UITableViewCellSelectionStyle.None;
}
示例3: ProductViewControllerToggleTableViewCell
public ProductViewControllerToggleTableViewCell(IntPtr handle)
: base(handle)
{
SelectionStyle = UITableViewCellSelectionStyle.None;
toggleSwitch = new UISwitch ();
AccessoryView = toggleSwitch;
}
示例4: 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;
}
示例5: Include
public void Include (UISwitch sw)
{
sw.On = !sw.On;
sw.ValueChanged += (sender, args) => {
sw.On = false;
};
}
示例6: 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;
}
示例7: toggleAutomaticWaiting
void toggleAutomaticWaiting (UISwitch sender)
{
// Check for the new value of the switch and update AVPlayer property and user defaults
if(Player != null)
Player.AutomaticallyWaitsToMinimizeStalling = AutomaticWaitingSwitch.On;
NSUserDefaults.StandardUserDefaults.SetBool (AutomaticWaitingSwitch.On, "disableAutomaticWaiting");
}
示例8: LoadView
public override void LoadView ()
{
base.LoadView ();
var camera = CameraPosition.FromCamera (latitude: 30.2652898,
longitude: -97.7386826,
zoom: 17,
bearing: 15,
viewingAngle: 15);
mapView = MapView.FromCamera (View.Bounds, camera);
mapView.MapType = MapViewType.Normal;
mapView.MyLocationEnabled = true;
//mapView.Frame = View.Frame;
var hiltonOptions = new MarkerOptions();
hiltonOptions.Position = new MonoTouch.CoreLocation.CLLocationCoordinate2D(30.2652898, -97.7386826);
hiltonOptions.Title = "Evolve 2013";
hiltonOptions.Snippet = "Austin, TX";
mapView.AddMarker(hiltonOptions);
View.Add (mapView);
satelliteSwitch = new UISwitch ();
satelliteSwitch.Frame = new RectangleF(11.0f, 11.0f, satelliteSwitch.Frame.Width, satelliteSwitch.Frame.Height);
satelliteSwitch.On = false;
View.Add (satelliteSwitch);
currentLocNow = UIButton.FromType (UIButtonType.RoundedRect);
currentLocNow.Frame = new RectangleF(50, 100, 100, 20);
currentLocNow.Center = new PointF (View.Frame.Width/2, View.Frame.Height - 20.0f);
currentLocNow.SetTitle ("ShowMyLoc", UIControlState.Normal);
View.AddSubview (currentLocNow);
}
示例9: BoolFormatCell
public BoolFormatCell ()
{
swicth = new UISwitch ();
swicth.ValueChanged += Swicth_ValueChanged;
this.CanRenderUnLoad = false;
this.AddSubview (swicth);
}
示例10: ViewDidLoad
public override void ViewDidLoad()
{
View = new UIView(){ BackgroundColor = UIColor.White};
base.ViewDidLoad();
// ios7 layout
if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
EdgesForExtendedLayout = UIRectEdge.None;
var textFieldTitle = new UITextField(new RectangleF(10, 10, 300, 30));
Add(textFieldTitle);
var picker = new UIPickerView();
var pickerViewModel = new MvxPickerViewModel(picker);
picker.Model = pickerViewModel;
picker.ShowSelectionIndicator = true;
textFieldTitle.InputView = picker;
var textFieldFirstName = new UITextField(new RectangleF(10, 40, 300, 30));
Add(textFieldFirstName);
var textFieldLastName = new UITextField(new RectangleF(10, 70, 300, 30));
Add(textFieldLastName);
var acceptedLabel = new UILabel(new RectangleF(10, 100, 200, 30));
acceptedLabel.Text = "Accepted?";
Add(acceptedLabel);
var accepted = new UISwitch(new RectangleF(210, 100, 100, 30));
Add(accepted);
var add = new UIButton(UIButtonType.RoundedRect);
add.SetTitle("Add", UIControlState.Normal);
add.TintColor = UIColor.Purple;
add.Frame = new RectangleF(10,130,300,30);
Add(add);
var table = new UITableView(new RectangleF(10, 160, 300, 300));
Add(table);
var source = new MvxStandardTableViewSource(table, "TitleText FirstName");
table.Source = source;
var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
set.Bind(textFieldFirstName).To(vm => vm.FirstName);
set.Bind(textFieldLastName).To(vm => vm.LastName);
set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.Titles);
set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Title);
set.Bind(textFieldTitle).To(vm => vm.Title);
set.Bind(accepted).To(vm => vm.Accepted);
set.Bind(add).To("Add");
set.Bind(source).To(vm => vm.People);
set.Apply();
var tap = new UITapGestureRecognizer(() =>
{
foreach (var view in View.Subviews)
{
var text = view as UITextField;
if (text != null)
text.ResignFirstResponder();
}
});
View.AddGestureRecognizer(tap);
}
示例11: SubscriptionPreferenceUpdated
partial void SubscriptionPreferenceUpdated (UISwitch sender)
{
if (sender.On) {
CloudManager.Subscribe ();
} else {
CloudManager.Unsubscribe ();
}
}
示例12: SwitchCell
public SwitchCell()
: base(UITableViewCellStyle.Default, MultipleItemSelectionWithSwitchesViewController.ReuseIdentifier)
{
_switch = new UISwitch();
AccessoryView = _switch;
SelectionStyle = UITableViewCellSelectionStyle.None;
}
开发者ID:TheRealAdamKemp,项目名称:TableViewDemo,代码行数:9,代码来源:MultipleItemSelectionWithSwitchesViewController.cs
示例13: AddSubCatItem
public void AddSubCatItem(iProPQRSPortableLib.Type item)
{
AttribType SelectedItem=SelectedAllType.Find(u=>u.ProcAttribTypeID == item.ProcAttribTypeID );
UIView uvblock=new UIView(new CoreGraphics.CGRect(0,Ycord,380,60));
UISwitch usOption=new UISwitch(new CoreGraphics.CGRect(8,10,51,31));
usOption.Tag = item.ProcAttribTypeID;
if (SelectedItem != null) {
usOption.On = true;
SaveAttribTypeList.Add (SelectedItem);
SubCattextvalue.Add(item.Label);
}
usOption.ValueChanged += (object sender, EventArgs e) => {
AttribType additem=new AttribType();
additem.IsHighLighted=false;
additem.ProcAttribTypeID= item.ProcAttribTypeID;
additem.ProcID=ProcID;
additem.Value=item.Label;
AttribType existingitem= SelectedAllType.Find(u=>u.ProcAttribTypeID == item.ProcAttribTypeID );
if(usOption.On)
{
if(existingitem == null)
SaveAttribTypeList.Add (additem);
SubCattextvalue.Add(item.Label);
}
else
{
SubCattextvalue.Remove(item.Label);
if(existingitem != null)
{
existingitem.Value="";
SaveAttribTypeList.Remove (existingitem);
SaveAttribTypeList.Add (existingitem);
}
}
};
UILabel lbldesc=new UILabel(new CoreGraphics.CGRect(78,10,300,50));
lbldesc.Lines = 2;
lbldesc.Text = item.Label;
uslist.Add (usOption);
UIView uvbreackline=new UIView(new CoreGraphics.CGRect(0,60,380,1));
uvbreackline.BackgroundColor = UIColor.Gray;
uvblock.Add (usOption);
uvblock.Add (lbldesc);
uvblock.Add (uvbreackline);
usSubCatView.Add (uvblock);
Ycord = Ycord + 61;
usSubCatView.SizeToFit ();
usSubCatView.ContentSize = new SizeF (float.Parse (usSubCatView.Frame.Width.ToString ()), float.Parse (usSubCatView.Frame.Height.ToString ()) + (float)Ycord-100 );
}
示例14: LabelSwitchView
public LabelSwitchView ()
{
Add (label = new UILabel () {
TranslatesAutoresizingMaskIntoConstraints = false,
});
Add (toggle = new UISwitch () {
TranslatesAutoresizingMaskIntoConstraints = false,
});
}
示例15: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
#region UI Controls (you could do this in XIB if you want)
saveButton = UIButton.FromType(UIButtonType.RoundedRect);
saveButton.Frame = new RectangleF(10,10,145,50);
saveButton.SetTitle("Save", UIControlState.Normal);
saveButton.SetTitle("waiting...", UIControlState.Disabled);
saveButton.Enabled = false;
doneSwitch = new UISwitch();
doneSwitch.Frame = new RectangleF(180, 25, 145, 50);
doneSwitch.Enabled = false;
doneLabel = new UILabel();
doneLabel.Frame = new RectangleF(200, 10, 145, 15);
doneLabel.Text = "Done?";
titleText = new UITextView(new RectangleF(10, 70, 300, 40));
titleText.BackgroundColor = UIColor.FromRGB(240,240,240);
titleText.Editable = true;
titleText.BackgroundColor = UIColor.FromRGB(240,240,240);
descriptionText = new UITextView(new RectangleF(10, 130, 300, 180));
descriptionText.BackgroundColor = UIColor.FromRGB(240,240,240);
descriptionText.Editable = true;
descriptionText.ScrollEnabled = true;
descriptionText.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
// Add the controls to the view
this.Add(saveButton);
this.Add(doneLabel);
this.Add(doneSwitch);
this.Add(descriptionText);
this.Add(titleText);
#endregion
saveButton.TouchUpInside += (sender, e) => {
doc.TheTask.Title = titleText.Text;
doc.TheTask.Description = descriptionText.Text;
doc.TheTask.IsDone = doneSwitch.On;
doc.UpdateChangeCount (UIDocumentChangeKind.Done); // tell UIDocument it needs saving
descriptionText.ResignFirstResponder (); // hide keyboard
titleText.ResignFirstResponder ();
};
LoadData ();
NSNotificationCenter.DefaultCenter.AddObserver (this
, new Selector("dataReloaded:")
, new NSString("taskModified"),
null);
}