forked from xamarin/ios-samples
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial checkin of StandardControls sample.
- Loading branch information
Bryan Costanich
committed
Feb 28, 2012
1 parent
7a777f8
commit 3ddf9ca
Showing
108 changed files
with
11,450 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Sound | ||
===== | ||
This example application illustrates how to use a number of standard controls including: | ||
* Action Sheet | ||
* Activity Spinner | ||
* Alert View | ||
* Button | ||
* Date Picker | ||
* Image View | ||
* Label | ||
* Pager Control | ||
* Progress Bar | ||
* Scroll View | ||
* Segmented Controlr | ||
* Slider | ||
* Switch | ||
* Text Field | ||
* Toolbar | ||
|
||
Authors | ||
------- | ||
Bryan Costanich |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandardControls", "StandardControls\StandardControls.csproj", "{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|iPhoneSimulator = Debug|iPhoneSimulator | ||
Release|iPhoneSimulator = Release|iPhoneSimulator | ||
Debug|iPhone = Debug|iPhone | ||
Release|iPhone = Release|iPhone | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhone.ActiveCfg = Debug|iPhone | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhone.Build.0 = Debug|iPhone | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhone.ActiveCfg = Release|iPhone | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhone.Build.0 = Release|iPhone | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator | ||
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator | ||
EndGlobalSection | ||
GlobalSection(MonoDevelopProperties) = preSolution | ||
StartupItem = StandardControls\StandardControls.csproj | ||
EndGlobalSection | ||
EndGlobal |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using MonoTouch.UIKit; | ||
using MonoTouch.Foundation; | ||
|
||
namespace Example_StandardControls | ||
{ | ||
[Register("AppDelegate")] | ||
public class AppDelegate : UIApplicationDelegate | ||
{ | ||
#region -= declarations and properties =- | ||
|
||
protected UIWindow window; | ||
protected UINavigationController mainNavController; | ||
protected Example_StandardControls.Screens.iPhone.Home.HomeNavController iPhoneHome; | ||
protected Example_StandardControls.Screens.iPad.Home.HomeNavController iPadHome; | ||
|
||
#endregion | ||
|
||
public override bool FinishedLaunching (UIApplication app, NSDictionary options) | ||
{ | ||
// create our window | ||
window = new UIWindow (UIScreen.MainScreen.Bounds); | ||
window.MakeKeyAndVisible (); | ||
|
||
// instantiate our main navigatin controller and add it's view to the window | ||
mainNavController = new UINavigationController (); | ||
|
||
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { | ||
iPhoneHome = new Example_StandardControls.Screens.iPhone.Home.HomeNavController (); | ||
mainNavController.PushViewController (iPhoneHome, false); | ||
} else { | ||
iPadHome = new Example_StandardControls.Screens.iPad.Home.HomeNavController (); | ||
mainNavController.PushViewController (iPadHome, false); | ||
} | ||
|
||
window.RootViewController = mainNavController; | ||
|
||
// | ||
return true; | ||
} | ||
|
||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using MonoTouch.UIKit; | ||
|
||
namespace Example_StandardControls | ||
{ | ||
public class Application// : UIApplication | ||
{ | ||
public static void Main (string[] args) | ||
{ | ||
try | ||
{ | ||
UIApplication.Main (args, null, "AppDelegate"); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine (e.ToString ()); | ||
} | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
using System; | ||
using MonoTouch.UIKit; | ||
|
||
namespace Xamarin.Code | ||
{ | ||
public class NavItem | ||
{ | ||
/// <summary> | ||
/// The name of the nav item, shows up as the label | ||
/// </summary> | ||
public string Name | ||
{ | ||
get { return name; } | ||
set { name = value; } | ||
} | ||
protected string name; | ||
|
||
/// <summary> | ||
/// The UIViewController that the nav item opens. Use this property if you | ||
/// wanted to early instantiate the controller when the nav table is built out, | ||
/// otherwise just set the Type property and it will lazy-instantiate when the | ||
/// nav item is clicked on. | ||
/// </summary> | ||
public UIViewController Controller | ||
{ | ||
get { return controller; } | ||
set { controller = value; } | ||
} | ||
protected UIViewController controller; | ||
|
||
/// <summary> | ||
/// Path to the image to show in the nav item | ||
/// </summary> | ||
public string ImagePath | ||
{ | ||
get { return imagePath; } | ||
set { imagePath = value; } | ||
} | ||
protected string imagePath; | ||
|
||
/// <summary> | ||
/// The Type of the UIViewController. Set this to the type and leave the Controller | ||
/// property empty to lazy-instantiate the ViewController when the nav item is | ||
/// clicked. | ||
/// </summary> | ||
public Type ControllerType | ||
{ | ||
get { return controllerType; } | ||
set { controllerType = value; } | ||
} | ||
protected Type controllerType; | ||
|
||
/// <summary> | ||
/// a list of the constructor args (if neccesary) for the controller. use this in | ||
/// conjunction with ControllerType if lazy-creating controllers. | ||
/// </summary> | ||
public object[] ControllerConstructorArgs | ||
{ | ||
get { return controllerConstructorArgs; } | ||
set | ||
{ | ||
controllerConstructorArgs = value; | ||
|
||
controllerConstructorTypes = new Type[controllerConstructorArgs.Length]; | ||
for (int i = 0; i < controllerConstructorArgs.Length; i++) { | ||
controllerConstructorTypes[i] = controllerConstructorArgs[i].GetType (); | ||
} | ||
} | ||
} | ||
protected object[] controllerConstructorArgs = new object[] {}; | ||
|
||
/// <summary> | ||
/// The types of constructor args. | ||
/// </summary> | ||
public Type[] ControllerConstructorTypes | ||
{ | ||
get { return controllerConstructorTypes; } | ||
} | ||
protected Type[] controllerConstructorTypes = Type.EmptyTypes; | ||
|
||
public NavItem () | ||
{ | ||
} | ||
|
||
public NavItem (string name) : this() | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public NavItem (string name, UIViewController controller) : this (name) | ||
{ | ||
this.controller = controller; | ||
} | ||
|
||
public NavItem (string name, Type controllerType) : this (name) | ||
{ | ||
this.controllerType = controllerType; | ||
} | ||
|
||
public NavItem (string name, Type controllerType, object[] controllerConstructorArgs) : this (name, controllerType) | ||
{ | ||
this.ControllerConstructorArgs = controllerConstructorArgs; | ||
} | ||
|
||
public NavItem (string name, UIViewController controller, string imagePath) : this (name, controller) | ||
{ | ||
this.imagePath = imagePath; | ||
} | ||
|
||
public NavItem (string name, string imagePath, Type controllerType) : this (name, controllerType) | ||
{ | ||
this.imagePath = imagePath; | ||
} | ||
|
||
public NavItem (string name, string imagePath, Type controllerType, object[] controllerConstructorArgs) : this (name, controllerType, controllerConstructorArgs) | ||
{ | ||
this.imagePath = imagePath; | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Xamarin.Code | ||
{ | ||
/// <summary> | ||
/// A group that contains table items | ||
/// </summary> | ||
public class NavItemGroup | ||
{ | ||
public string Name { get; set; } | ||
|
||
public string Footer { get; set; } | ||
|
||
public List<NavItem> Items | ||
{ | ||
get { return items; } | ||
set { items = value; } | ||
} | ||
protected List<NavItem> items = new List<NavItem> (); | ||
|
||
public NavItemGroup () { } | ||
|
||
public NavItemGroup (string name) | ||
{ | ||
Name = name; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
Oops, something went wrong.