Skip to content

Commit 5565d0f

Browse files
committed
Restructured the sample
1 parent 91a3f95 commit 5565d0f

15 files changed

+247
-104
lines changed

Details.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
The `FlyOutNavigationController` presents a simple navigation view that
2+
appears to slide out from underneath a main view, allowing you to
3+
navigate among a list of view controllers. The same view also functions
4+
as a `UISplitViewController` on the iPad.
5+
6+
```csharp
7+
using FlyOutNavigation;
8+
using MonoTouch.Dialog;
9+
...
10+
public override void ViewDidLoad ()
11+
{
12+
base.ViewDidLoad ();
13+
var navigation = new FlyOutNavigationController {
14+
// Create the navigation menu
15+
NavigationRoot = new RootElement ("Navigation") {
16+
new Section ("Pages") {
17+
new StringElement ("Animals"),
18+
new StringElement ("Vegetables"),
19+
new StringElement ("Minerals"),
20+
}
21+
},
22+
// Supply view controllers corresponding to menu items:
23+
ViewControllers = new [] {
24+
new UIViewController { View = new UILabel { Text = "Animals (drag right)" } },
25+
new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } },
26+
new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } },
27+
},
28+
};
29+
// Show the navigation view
30+
navigation.ToggleMenu ();
31+
View.AddSubview (navigation.View);
32+
}
33+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyOutNavigationSample", "FlyOutNavigationSample\FlyOutNavigationSample.csproj", "{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|iPhoneSimulator = Debug|iPhoneSimulator
9+
Release|iPhoneSimulator = Release|iPhoneSimulator
10+
Debug|iPhone = Debug|iPhone
11+
Release|iPhone = Release|iPhone
12+
Ad-Hoc|iPhone = Ad-Hoc|iPhone
13+
AppStore|iPhone = AppStore|iPhone
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
17+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
18+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
19+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.AppStore|iPhone.Build.0 = AppStore|iPhone
20+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Debug|iPhone.ActiveCfg = Debug|iPhone
21+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Debug|iPhone.Build.0 = Debug|iPhone
22+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
23+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
24+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Release|iPhone.ActiveCfg = Release|iPhone
25+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Release|iPhone.Build.0 = Release|iPhone
26+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
27+
{E41D211D-4730-4B57-8A83-CAC9E60EAC4A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
28+
EndGlobalSection
29+
GlobalSection(MonoDevelopProperties) = preSolution
30+
StartupItem = FlyOutNavigationSample\FlyOutNavigationSample.csproj
31+
EndGlobalSection
32+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Linq;
3+
using System.Collections.Generic;
4+
5+
using MonoTouch.Foundation;
6+
using MonoTouch.UIKit;
7+
using MonoTouch.Dialog;
8+
9+
using FlyOutNavigation;
10+
11+
namespace Sample
12+
{
13+
[Register ("AppDelegate")]
14+
public partial class AppDelegate : UIApplicationDelegate
15+
{
16+
UIWindow window;
17+
18+
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
19+
{
20+
window = new UIWindow (UIScreen.MainScreen.Bounds) {
21+
RootViewController = new MainController ()
22+
};
23+
window.MakeKeyAndVisible ();
24+
return true;
25+
}
26+
}
27+
}
28+
Loading

Sample/FlyOutNavigationSample.csproj FlyOutNavigationSample/FlyOutNavigationSample/FlyOutNavigationSample.csproj

+5-7
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,20 @@
6060
<Reference Include="System.Core" />
6161
<Reference Include="monotouch" />
6262
<Reference Include="MonoTouch.Dialog-1" />
63+
<Reference Include="FlyOutNavigation">
64+
<HintPath>..\..\FlyOutNavigation\bin\Release\FlyOutNavigation.dll</HintPath>
65+
</Reference>
6366
</ItemGroup>
6467
<ItemGroup>
6568
<None Include="Info.plist" />
6669
</ItemGroup>
6770
<ItemGroup>
6871
<Compile Include="Main.cs" />
6972
<Compile Include="AppDelegate.cs" />
73+
<Compile Include="MainController.cs" />
7074
</ItemGroup>
7175
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
7276
<ItemGroup>
73-
<Content Include="jhill.jpeg" />
74-
</ItemGroup>
75-
<ItemGroup>
76-
<ProjectReference Include="..\FlyOutNavigation\FlyOutNavigation.csproj">
77-
<Project>{E98F7600-6C2E-4586-A78C-D42BA89445B9}</Project>
78-
<Name>FlyOutNavigation</Name>
79-
</ProjectReference>
77+
<BundleResource Include="Default-568h%402x.png" />
8078
</ItemGroup>
8179
</Project>
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
using MonoTouch.UIKit;
4+
using MonoTouch.Foundation;
5+
6+
namespace Sample
7+
{
8+
public class Application
9+
{
10+
static void Main (string[] args)
11+
{
12+
UIApplication.Main (args, null, "AppDelegate");
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using System.Linq;
3+
using System.Collections.Generic;
4+
5+
using MonoTouch.Foundation;
6+
using MonoTouch.UIKit;
7+
using MonoTouch.Dialog;
8+
9+
using FlyOutNavigation;
10+
11+
namespace Sample
12+
{
13+
public class MainController : UIViewController
14+
{
15+
FlyOutNavigationController navigation;
16+
17+
// Data we'll use to create our flyout menu and views:
18+
string[] Tasks = {
19+
"Get Xamarin",
20+
"Learn C#",
21+
"Write Killer App",
22+
"Add Platforms",
23+
"Profit",
24+
"Meet Obama",
25+
};
26+
27+
public override void ViewDidLoad ()
28+
{
29+
base.ViewDidLoad ();
30+
31+
// Create the flyout view controller, make it large,
32+
// and add it as a subview:
33+
navigation = new FlyOutNavigationController ();
34+
navigation.View.Frame = UIScreen.MainScreen.Bounds;
35+
View.AddSubview (navigation.View);
36+
37+
// Create the menu:
38+
navigation.NavigationRoot = new RootElement ("Task List") {
39+
new Section ("Task List") {
40+
from page in Tasks
41+
select new StringElement (page) as Element
42+
}
43+
};
44+
45+
// Create an array of UINavigationControllers that correspond to your
46+
// menu items:
47+
navigation.ViewControllers = Array.ConvertAll (Tasks, title =>
48+
new UINavigationController (new TaskPageController (navigation, title))
49+
);
50+
}
51+
52+
class TaskPageController : DialogViewController
53+
{
54+
public TaskPageController (FlyOutNavigationController navigation, string title) : base (null)
55+
{
56+
Root = new RootElement (title) {
57+
new Section {
58+
new CheckboxElement (title)
59+
}
60+
};
61+
NavigationItem.LeftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Action, delegate {
62+
navigation.ToggleMenu ();
63+
});
64+
}
65+
}
66+
}
67+
}
68+

GettingStarted.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
The `FlyOutNavigationController` presents a simple navigation view that
2+
appears to slide out from underneath a main view, allowing you to
3+
navigate among a list of view controllers. The same view also functions
4+
as a `UISplitViewController` on the iPad.
5+
6+
Place the following using statements and method overrides in your app's
7+
root view controller for a simple `FlyOutNavigationController` example:
8+
9+
```csharp
10+
using FlyOutNavigation;
11+
using MonoTouch.Dialog;
12+
...
13+
public override void ViewDidLoad ()
14+
{
15+
base.ViewDidLoad ();
16+
var navigation = new FlyOutNavigationController {
17+
// Create the navigation menu
18+
NavigationRoot = new RootElement ("Navigation") {
19+
new Section ("Pages") {
20+
new StringElement ("Animals"),
21+
new StringElement ("Vegetables"),
22+
new StringElement ("Minerals"),
23+
}
24+
},
25+
// Supply view controllers corresponding to menu items:
26+
ViewControllers = new [] {
27+
new UIViewController { View = new UILabel { Text = "Animals (drag right)" } },
28+
new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } },
29+
new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } },
30+
},
31+
};
32+
// Show the navigation view
33+
navigation.ToggleMenu ();
34+
View.AddSubview (navigation.View);
35+
}
36+
```
37+
38+
## Contact & Discuss
39+
40+
* Github Issues: https://github.com/xamarin/addons/issues/search?q=flyout&state=open
41+
* Author's Twitter: https://twitter.com/jtclancey

License.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2011 James Clancey
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

Sample/AppDelegate.cs

-78
This file was deleted.

Sample/Main.cs

-19
This file was deleted.

Sample/jhill.jpeg

-10.5 KB
Binary file not shown.

addon.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 1.1
2+
name: Flyout Navigation View
3+
id: flyoutnavigation
4+
publisher: James Clancey
5+
publisher-url: https://github.com/xamarin/addons/tree/flyout-navigation
6+
summary: A sleek navigation view that swipes in from the side.
7+
libraries:
8+
ios: FlyOutNavigation/Bin/Release/FlyOutNavigation.dll
9+
samples:
10+
"iOS Sample": FlyOutNavigationSample/FlyOutNavigationSample.sln
11+
build:
12+
- FlyOutNavigation.sln

icons/flyoutnavigation_128x128.png

7.39 KB
Loading

0 commit comments

Comments
 (0)