c# - 为什么不能更改 Monotouch.Dialog.TableView.Background 颜色

标签 c# ios xamarin.ios monotouch.dialog

为什么不能改变 MonoTouch.Dialog.TableView.Background 颜色?我正在使用 MonoTouch.Dialog 的元素 API。它仍然是灰色的!

class MyDialogViewController : DialogViewController {

public MyDialogViewController (RootElement root) : base (root)
{
}

public override void LoadView ()
{
    base.LoadView ();
    TableView.BackgroundColor = UIColor.Clear;
    UIImage background = UIImage.FromFile ("Mybackground.png");
    ParentViewController.View.BackgroundColor = UIColor.FromPatternImage (background);
}
}


public partial class MyVC: UINavigationController
{
    public void CreateTestUI()
    {

            var menu = new RootElement("MyMenu"){
            new Section ("test"){
                new StringElement("Test", delegate() { }), ...

        var dv = new MyDialogViewController (menu) {
            Autorotate = true
        };

        // add the nav controller to the window
        this.PushViewController (dv, true); 
      }
  }

最佳答案

在 iPad 中,必须添加这一行:TableView.BackgroundView = null;

现在它运行良好,感谢 poupou,感谢所有。

   public override void LoadView()
   {
        base.LoadView();
        TableView.BackgroundView = null;
        TableView.BackgroundColor = UIColor.Black;
   }

关于c# - 为什么不能更改 Monotouch.Dialog.TableView.Background 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12131910/

相关文章:

c# - 我如何持续监控新的 TCP 客户端?

ios - 升级到 iOS 9 和 MobileFirst 7.1 后无法在设备或模拟器上登录应用程序

ios - 更改所选 TextField 的背景颜色

c# - 如何将 UIActivityViewController 与 MonoTouch 一起使用

c# - 如何删除 mvc4 文本框中的默认日期?

c# - 将对象转换为可查询对象

c# - 嵌套异步/等待方法

ios - 是否可以在 iOS 推送通知的标题文本内显示图像?

xamarin - 警告 : Input PNG does not have an 8 bit input depth. 请将您的 PNG 转换为 8 位以在 iPhone OS 上获得最佳性能

ios - SpriteKit 声音不播放