C#上的noob问题 - 在下面的代码中,该行是什么
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;
}
}
答案 0 :(得分:4)
这行代码声明了一个名为window
的{{1}}类型的变量(其值最初为null):
UIWindow
此行为UWindow window;
变量赋值:
window
答案 1 :(得分:2)
UIWindow window;
这会创建一个UIWindow
类型的新变量window = new UIWindow (UIScreen.MainScreen.Bounds);
这会初始化窗口变量,在调用此行之前它为null。