Created
December 12, 2013 21:33
-
-
Save lobrien/7935879 to your computer and use it in GitHub Desktop.
Basic UITabView stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
using System.Drawing; | |
using MonoTouch.CoreGraphics; | |
namespace SingleFileTableViewSolution | |
{ | |
public class DirectionalView : UIView | |
{ | |
public DirectionalView() | |
{ | |
UILabel label = new UILabel(new RectangleF(10, 50, 300, 100)); | |
label.Text = "This Side Up"; | |
AddSubview(label); | |
} | |
} | |
public class SimpleController : UIViewController | |
{ | |
int orientation; | |
public SimpleController(int orientation) | |
{ | |
this.orientation = orientation; | |
this.TabBarItem = new UITabBarItem(UITabBarSystemItem.Search, orientation); | |
} | |
public override void ViewDidLoad() | |
{ | |
this.View = new DirectionalView(); | |
View.BackgroundColor = orientation == 0 ? UIColor.Red : orientation == 1 ? UIColor.Green : UIColor.Blue; | |
this.View.Transform = CGAffineTransform.MakeRotation((float) (Math.PI / 2 * orientation)); | |
} | |
} | |
[Register ("AppDelegate")] | |
public class AppDelegate : UIApplicationDelegate | |
{ | |
UIWindow window; | |
UITabBarController viewController; | |
public override bool FinishedLaunching(UIApplication app, NSDictionary options) | |
{ | |
viewController = new UITabBarController(); | |
viewController.AddChildViewController(new SimpleController(0)); | |
viewController.AddChildViewController(new SimpleController(1)); | |
viewController.AddChildViewController(new SimpleController(2)); | |
window = new UIWindow(UIScreen.MainScreen.Bounds); | |
window.RootViewController = viewController; | |
window.MakeKeyAndVisible(); | |
return true; | |
} | |
} | |
public class Application | |
{ | |
static void Main(string[] args) | |
{ | |
UIApplication.Main(args, null, "AppDelegate"); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment