如何在DialogViewController(Monotouch.Dialog)上设置背景色 [英] How to set the background color on a DialogViewController (Monotouch.Dialog)

查看:99
本文介绍了如何在DialogViewController(Monotouch.Dialog)上设置背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:使用Monotouch和Monotouch.Dialog库创建iPad应用程序.

environment: creating an iPad application using Monotouch and the Monotouch.Dialog library.

我一直试图将DialogViewController上的背景色设置为无效.我的应用程序中有多个视图正在被卸载.对于其中的一个,我设法设置背景色.

I've been trying to set the background color on a DialogViewController to no avail. I have multiple views in my application being loaded an unloaded. For non of them I manage to set the background color.

到目前为止我尝试过的事情:

What I have tried so far:

  • 在应用程序的主窗口上设置背景颜色->效果很好.
  • 创建一个简单的UIView,为其提供尺寸,设置背景颜色并将其加载到窗口中->效果很好.

但是,一旦我加载一个DialogViewController(带有关联的视图),背景色就总是灰色. DialogViewController是从Monotouch.Dialog框架中使用的.

But as soon as I load a DialogViewController (with an associated view) the background color is always gray. The DialogViewController is used from the Monotouch.Dialog framework.

我将DialogViewController推到导航控制器上,以显示在表视图中布置的一组按钮.

I'm pushing the DialogViewController onto a navigation controller to show a set of buttons laid out in a table view.

我一定错过了一些基本的东西!我一直在浏览Monotouch.Dialog代码,并尝试了其他一些方法,但是到目前为止,没有任何方法可以解决我的问题.

I must be missing out on something fundamental ! I have been looking through the Monotouch.Dialog code and tried a couple of other things, but nothing fixed my problem so far.

任何帮助都受到赞赏.

硼砂

推荐答案

您实际上需要将背景视图设置为null.这是表视图后面的视图,例如MonoTouch.Dialog

You actually need to set the background view to null. This is the view that is behind a table view, such as the grouped one in MonoTouch.Dialog

http://developer.apple .com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html

以下是该子类的外观:

 using System;
 using System.Drawing;
 using System.IO;
 using MonoTouch.Foundation;
 using MonoTouch.CoreGraphics;
 using MonoTouch.Dialog;
 using MonoTouch.UIKit;

 namespace MyNameSpace{

     public class MySpecialDialogViewController : DialogViewController {

       public MySpecialDialogViewController (UITableViewStyle style, RootElement root) 
              : base (style, root) 
         {
         }

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

  }

这篇关于如何在DialogViewController(Monotouch.Dialog)上设置背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆