-2

关于 C# 的完全菜鸟问题 - 在下面的代码中,该行是什么

UIWindow window; 

准确的意思,它与线的关系是什么

window = new UIWindow (UIScreen.MainScreen.Bounds);

“UIWindow 窗口”是某种变量声明吗?

public partial class AppDelegate : UIApplicationDelegate
{
    UIWindow window;
    HelloWorld_iPhoneViewController viewController;

    /// <summary>
    /// This method is invoked when the application has loaded and is ready to run. In this 
    /// method you should instantiate the window, load the UI into it and then make the window
    /// visible.
    /// </summary>
    /// <remarks>
    /// You have 5 seconds to return from this method, or iOS will terminate your application.
    /// </remarks>
    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
        // create a new window instance based on the screen size
        window = new UIWindow (UIScreen.MainScreen.Bounds);


        viewController = new HelloWorld_iPhoneViewController ("HelloWorld_iPhoneViewController", null);
        window.RootViewController = viewController;
        window.MakeKeyAndVisible ();

        return true;
    }
}
4

2 回答 2

4

这行代码声明了一个以window类型命名的变量UIWindow(其值最初为空):

UWindow window;

这一行为window变量赋值:

window = new UIWindow (UIScreen.MainScreen.Bounds);
于 2012-11-29T19:54:34.093 回答
2
UIWindow window;

这将创建一个 UIWindow 类型的新变量

window = new UIWindow (UIScreen.MainScreen.Bounds);

这将初始化窗口变量,在调用此行之前它为空。

于 2012-11-29T19:55:36.870 回答