// Loads either the iPad or iPhone view, based on the current device protected void LoadViewForDevice() { // load the appropriate view based on the device if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { mainViewController_iPad = new MainViewController_iPad(); this.View.AddSubview(mainViewController_iPad.View); mainScreen = mainViewController_iPad as IMainScreen; } else { mainViewController_iPhone = new MainViewController_iPhone(); this.View.AddSubview(mainViewController_iPhone.View); mainScreen = mainViewController_iPhone as IMainScreen; } }
// Loads either the iPad or iPhone view, based on the current device protected void LoadViewForDevice() { // load the appropriate view based on the device if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { mainViewController_iPad = new MainViewController_iPad(); this.View.AddSubview(mainViewController_iPad.View); mainScreen = mainViewController_iPad; } else { mainViewController_iPhone = new MainViewController_iPhone(); var b = this.View.Bounds; this.View.AddSubview(mainViewController_iPhone.View); mainViewController_iPhone.View.Frame = b; // for 4 inch iPhone5 screen mainScreen = mainViewController_iPhone; } }
//======================================================================== //======================================================================== #region -= protected methods =- //======================================================================== /// <summary> /// Loads either the iPad or iPhone view, based on the current device /// </summary> protected void LoadViewForDevice() { //---- load the appropriate view based on the device switch (((AppDelegate)UIApplication.SharedApplication.Delegate).CurrentDevice) { case DeviceType.iPad: this._mainViewController_iPad = new MainViewController_iPad(); this.View.AddSubview(this._mainViewController_iPad.View); this._mainScreen = this._mainViewController_iPad as IMainScreen; break; case DeviceType.iPhone: this._mainViewController_iPhone = new MainViewController_iPhone(); this.View.AddSubview(this._mainViewController_iPhone.View); this._mainScreen = this._mainViewController_iPhone as IMainScreen; break; default: break; } }