我需要一种设置 Monotouch Dialogs RootElement 样式的方法。我需要更改背景和字体颜色。
我已经创建了一个自定义 RootElement 如下
public class ActivityRootElement : RootElement
{
public ActivityRootElement (string caption) : base (caption)
{
}
public ActivityRootElement(string caption, Func<RootElement, UIViewController> createOnSelected) : base (caption, createOnSelected)
{
}
public ActivityRootElement(string caption, int section, int element) : base (caption, section, element)
{
}
public ActivityRootElement(string caption, Group group) : base (caption, group)
{
}
public override UITableViewCell GetCell (UITableView tv)
{
tv.BackgroundColor = Settings.RootBackgroundColour;
return base.GetCell (tv);
}
protected override void PrepareDialogViewController(UIViewController dvc)
{
dvc.View.BackgroundColor = Settings.RootBackgroundColour;
base.PrepareDialogViewController(dvc);
}
}
然后我调用自定义根元素,如下所示传入自定义 DialogController
section.Add (new ActivityRootElement(activity.Name, (RootElement e) => {
return new ActivityHistoryDialogViewController (e,true);
}));
未应用根元素样式。任何帮助将不胜感激!!