OGeek|极客世界-中国程序员成长平台

标题: c# - 带有字幕的 CheckboxElement 使用 MonoTouch.Dialog [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:45
标题: c# - 带有字幕的 CheckboxElement 使用 MonoTouch.Dialog

我是 iPhone 开发的新手。 我正在为 iPhone 应用程序使用 Monotouch.Dialog。

我们可以创建一个显示字幕的 StyledStringElement。

我想显示一个带字幕的 CheckboxElement。 这可能吗?

提前致谢。



Best Answer-推荐答案


是的,您必须:

(a) 继承 StyledStringElementCheckboxElement 并从另一个中复制粘贴所需的代码。如果您的应用程序中需要许多此类元素,则很有用。

(b) 直接在元素中添加一些代码(以防你只需要其中一个),比​​如:

var checked_styled_element = new StyledStringElement ("Checked", "value");
checked_styled_element.Tapped += () => {
    checked_styled_element.Accessory = (checked_styled_element.Accessory == UITableViewCellAccessory.Checkmark) ? UITableViewCellAccessory.None : UITableViewCellAccessory.Checkmark;
    checked_styled_element.GetImmediateRootElement ().Reload (checked_styled_element, UITableViewRowAnimation.None);
};

关于c# - 带有字幕的 CheckboxElement 使用 MonoTouch.Dialog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8036075/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4