Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions Demo/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

Expand All @@ -11,11 +7,10 @@ namespace Demo
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UINavigationController navigationController;
UIWindow window;
UIWindow _window;

//
// This method is invoked when the application has loaded and is ready to run. In this
Expand All @@ -26,18 +21,13 @@ public partial class AppDelegate : UIApplicationDelegate
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
window = new UIWindow(UIScreen.MainScreen.Bounds);

/*
var controller = new MainViewController();
navigationController = new UINavigationController(controller);
window.RootViewController = navigationController;
*/

window.RootViewController = new FullScreenDemo();
_window = new UIWindow(UIScreen.MainScreen.Bounds)
{
RootViewController = new FullScreenDemo()
};

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

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions Demo/Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -104,7 +104,7 @@
<Compile Include="RecalculateLayoutDemo.cs" />
<Compile Include="FullScreenDemo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
<ItemGroup>
<BundleResource Include="Resources\chrome_topten.png" />
<BundleResource Include="Resources\tts512.png" />
Expand Down
28 changes: 12 additions & 16 deletions Demo/Demo1.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using System;
using System.Drawing;
using System.Collections.Generic;

using MonoTouch.UIKit;
using MonoTouch.Foundation;

using XibFree;

namespace Demo
{
public partial class Demo1 : UITableViewController
public sealed class Demo1 : UITableViewController
{
public Demo1()
{
Expand All @@ -25,7 +21,7 @@ public override void LoadView()
SubViews = new View[]
{
// A NativeView contains an iOS UIView
new NativeView()
new NativeView
{
// This is the UIView
View = new UIView(RectangleF.Empty)
Expand All @@ -35,33 +31,33 @@ public override void LoadView()
},

// This controls how it's laid out by its parent view group (in this case the outer linear layout)
LayoutParameters = new LayoutParameters()
LayoutParameters = new LayoutParameters
{
Width = AutoSize.FillParent,
Height = 50,
Width = Dimension.FillParent,
Height = Dimension.Absolute(50),
},
},

// A second view that will be stacked below the first
new NativeView()
new NativeView
{
View = new UIView(RectangleF.Empty)
{
BackgroundColor = UIColor.Blue,
},

LayoutParameters = new LayoutParameters()
LayoutParameters = new LayoutParameters
{
Width = AutoSize.FillParent,
Height = 50,
Width = Dimension.FillParent,
Height = Dimension.Absolute(50),
},
},
}
},
};

// We've now defined our layout, to actually use it we simply create a UILayoutHost control and pass it the layout
this.View = new XibFree.UILayoutHost(layout);
this.View.BackgroundColor=UIColor.Gray;
View = new UILayoutHost(layout);
View.BackgroundColor=UIColor.Gray;
}
}
}
59 changes: 19 additions & 40 deletions Demo/FrameLayoutDemo.cs
Original file line number Diff line number Diff line change
@@ -1,100 +1,79 @@
using System;
using System.Drawing;
using System.Collections.Generic;

using MonoTouch.UIKit;
using MonoTouch.Foundation;

using XibFree;

namespace Demo
{
public partial class FrameLayoutDemo : UITableViewController
public sealed class FrameLayoutDemo : UITableViewController
{
public FrameLayoutDemo()
{
Title = "FrameLayout";

// Custom initialization
}

public override void DidReceiveMemoryWarning()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning();

// Release any cached data, images, etc that aren't in use.
}

[Obsolete ("Deprecated in iOS6. Replace it with both GetSupportedInterfaceOrientations and PreferredInterfaceOrientationForPresentation")]
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
{
return true;
}

public override void ViewDidLoad()
{
base.ViewDidLoad();
}

public override void LoadView()
{

// Frame layouts allow subviews that overlap each other
var layout = new FrameLayout()
var layout = new FrameLayout
{
Padding = new UIEdgeInsets(10,10,10,10),
SubViews = new View[]
{
new NativeView()
new NativeView
{
View = new UIView()
View = new UIView
{
BackgroundColor = UIColor.FromRGBA(255,0,0,128),
},
LayoutParameters = new LayoutParameters()
LayoutParameters = new LayoutParameters
{
Width = AutoSize.FillParent,
Height = AutoSize.FillParent,
Width = Dimension.FillParent,
Height = Dimension.FillParent,
}
},

new NativeView()
new NativeView
{
View = new UIView()
View = new UIView
{
BackgroundColor = UIColor.FromRGBA(0,0,255,128),
},
LayoutParameters = new LayoutParameters()
LayoutParameters = new LayoutParameters
{
Width = AutoSize.FillParent,
Height = 100,
Width = Dimension.FillParent,
Height = Dimension.Absolute(100),
Margins = new UIEdgeInsets(10,10,10,10),
Gravity = Gravity.Bottom,
}
},

new NativeView()
new NativeView
{
View = new UIView()
View = new UIView
{
BackgroundColor = UIColor.FromRGBA(0,0,0,128),
},
LayoutParameters = new LayoutParameters()
LayoutParameters = new LayoutParameters
{
Width = AutoSize.FillParent,
Height = 80,
Width = Dimension.FillParent,
Height = Dimension.Absolute(80),
Margins = new UIEdgeInsets(10,-10,10,-10),
Gravity = Gravity.CenterVertical,
}
}
},
};


// We've now defined our layout, to actually use it we simply create a UILayoutHost control and pass it the layout
this.View = new XibFree.UILayoutHost(layout);
this.View.BackgroundColor=UIColor.Gray;
View = new UILayoutHost(layout);
View.BackgroundColor=UIColor.Gray;
}
}
}
Loading