Exemple #1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            // load the appropriate UI, depending on whether the app is running on an iPhone or iPad
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
                var controller = new RootViewController ();
                navigationController = new UINavigationController (controller);
                window.RootViewController = navigationController;
            } else {
                var masterViewController = new RootViewController ();
                var masterNavigationController = new UINavigationController (masterViewController);
                var detailViewController = new DetailViewController ();
                var detailNavigationController = new UINavigationController (detailViewController);

                splitViewController = new UISplitViewController ();
                splitViewController.WeakDelegate = detailViewController;
                splitViewController.ViewControllers = new UIViewController[] {
                    masterNavigationController,
                    detailNavigationController
                };

                window.RootViewController = splitViewController;
            }

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
 /*
 // Override to support conditional editing of the table view.
 public override bool CanEditRow (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
 {
     // Return false if you do not want the specified item to be editable.
     return true;
 }
 */
 /*
 // Override to support editing the table view.
 public override void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
 {
     if (editingStyle == UITableViewCellEditingStyle.Delete) {
         // Delete the row from the data source.
         controller.TableView.DeleteRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
     } else if (editingStyle == UITableViewCellEditingStyle.Insert) {
         // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
     }
 }
 */
 /*
 // Override to support rearranging the table view.
 public override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath)
 {
 }
 */
 /*
 // Override to support conditional rearranging of the table view.
 public override bool CanMoveRow (UITableView tableView, NSIndexPath indexPath)
 {
     // Return false if you do not want the item to be re-orderable.
     return true;
 }
 */
 public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
 {
     if (UserInterfaceIdiomIsPhone) {
         var DetailViewController = new DetailViewController ();
         // Pass the selected object to the new view controller.
         controller.NavigationController.PushViewController (
             DetailViewController,
             true
         );
     } else {
         // Navigation logic may go here -- for example, create and push another view controller.
     }
 }