Utter noob question on C# – in the code below, what does the line
UIWindow window;
mean exactly and what is its relationship to the line
window = new UIWindow (UIScreen.MainScreen.Bounds);
Is “UIWindow window” some kind of variable declaration?
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;
}
}
This line of code declares a variable named
windowof the typeUIWindow(the value of which is initially null):And this line assigns a value to the
windowvariable: