本文整理汇总了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;
}
示例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;
}
示例3: prepareCell
private void prepareCell(){
_switch = new UISwitch (){
BackgroundColor = UIColor.Clear
};
_switch.AddTarget (delegate {
_element.Value = _switch.On;
}, UIControlEvent.ValueChanged);
AccessoryView = _switch;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}