This commit is contained in:
Bryan Costanich 2012-02-24 17:29:34 -08:00
Родитель 3573abfa41
Коммит 8ab790984a
63 изменённых файлов: 7535 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<SampleMetadata>
<ID>49eb269c-80c4-41a6-873a-946a6dfc7282</ID>
<IsFullApplication>false</IsFullApplication>
<Level>Intermediate</Level>
<Tags>Shared Resources</Tags>
</SampleMetadata>

32
SharedResources/README.md Normal file
Просмотреть файл

@ -0,0 +1,32 @@
Core Location
=============
This sample illustrates how to work with various iOS resources including: the accelerometer, photo/video library, camera, battery status, contacts, file system, and network activity indicator.
License
-------
The samples are licensed under the MIT X11 license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Authors
-------
Bryan Costanich

Двоичные данные
SharedResources/Screenshots/01.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 MiB

Просмотреть файл

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedResources", "SharedResources\SharedResources.csproj", "{7624AE01-3981-42DC-AA85-9D88A2CF6840}"
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
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Debug|iPhone.ActiveCfg = Debug|iPhone
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Debug|iPhone.Build.0 = Debug|iPhone
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Release|iPhone.ActiveCfg = Release|iPhone
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Release|iPhone.Build.0 = Release|iPhone
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{7624AE01-3981-42DC-AA85-9D88A2CF6840}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = SharedResources\SharedResources.csproj
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,62 @@
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Example_SharedResources
{
//========================================================================
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
//========================================================================
#region -= declarations and properties =-
protected UIWindow window;
protected UINavigationController mainNavController;
protected Example_SharedResources.Screens.iPhone.Home.HomeNavController iPhoneHome;
protected int networkActivityCount = 0;
#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 ();
iPhoneHome = new Example_SharedResources.Screens.iPhone.Home.HomeNavController ();
mainNavController.PushViewController (iPhoneHome, false);
window.RootViewController = mainNavController;
//----
return true;
}
//========================================================================
//========================================================================
/// <summary>
/// Keeps a running reference of items that want to turn the network activity on or off
/// so it doesn't get turned off by one activity if another is still active
/// </summary>
public void SetNetworkActivityIndicator(bool onOrOff)
{
//---- increment or decrement our reference count
if(onOrOff)
{ networkActivityCount++; }
else { networkActivityCount--; }
//---- set it's visibility based on whether or not there is still activity
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = (networkActivityCount > 0);
}
//========================================================================
}
//========================================================================
}

Просмотреть файл

@ -0,0 +1,20 @@
using System;
using MonoTouch.UIKit;
namespace Example_SharedResources
{
public class Application// : UIApplication
{
public static void Main (string[] args)
{
try
{
UIApplication.Main (args, null, "AppDelegate");
}
catch (Exception e)
{
Console.WriteLine (e.ToString ());
}
}
}
}

Просмотреть файл

@ -0,0 +1,121 @@
using System;
using MonoTouch.UIKit;
namespace Example_SharedResources.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;
}
}
}

Просмотреть файл

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
namespace Example_SharedResources.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;
}
}
}

Просмотреть файл

@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Reflection;
namespace Example_SharedResources.Code
{
/// <summary>
/// Combined DataSource and Delegate for our UITableView
/// </summary>
public class NavItemTableSource : UITableViewSource
{
protected List<NavItemGroup> navItems;
string cellIdentifier = "NavTableCellView";
UINavigationController navigationController;
public NavItemTableSource (UINavigationController navigationController, List<NavItemGroup> items)
{
navItems = items;
this.navigationController = navigationController;
}
/// <summary>
/// Called by the TableView to determine how many sections(groups) there are.
/// </summary>
public override int NumberOfSections (UITableView tableView)
{
return navItems.Count;
}
/// <summary>
/// Called by the TableView to determine how many cells to create for that particular section.
/// </summary>
public override int RowsInSection (UITableView tableview, int section)
{
return navItems[section].Items.Count;
}
/// <summary>
/// Called by the TableView to retrieve the header text for the particular section(group)
/// </summary>
public override string TitleForHeader (UITableView tableView, int section)
{
return navItems[section].Name;
}
/// <summary>
/// Called by the TableView to retrieve the footer text for the particular section(group)
/// </summary>
public override string TitleForFooter (UITableView tableView, int section)
{
return navItems[section].Footer;
}
/// <summary>
/// Called by the TableView to actually build each cell.
/// </summary>
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// declare vars
NavItem navItem = navItems[indexPath.Section].Items[indexPath.Row];
UIImage navIcon = null;
var cell = tableView.DequeueReusableCell (this.cellIdentifier);
if (cell == null) {
cell = new UITableViewCell (UITableViewCellStyle.Default, this.cellIdentifier);
cell.Tag = Environment.TickCount;
}
// set the cell properties
cell.TextLabel.Text = navItems[indexPath.Section].Items[indexPath.Row].Name;
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
// return the cell
return cell;
}
/// <summary>
/// Is called when a row is selected
/// </summary>
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
// get a reference to the nav item
NavItem navItem = navItems[indexPath.Section].Items[indexPath.Row];
// if the nav item has a proper controller, push it on to the NavigationController
// NOTE: we could also raise an event here, to loosely couple this, but isn't neccessary,
// because we'll only ever use this this way
if (navItem.Controller != null) {
navigationController.PushViewController (navItem.Controller, true);
// show the nav bar (we don't show it on the home page)
navigationController.NavigationBarHidden = false;
}
else
{
if (navItem.ControllerType != null) {
//
ConstructorInfo ctor = null;
// if the nav item has constructor aguments
if (navItem.ControllerConstructorArgs.Length > 0) {
// look for the constructor
ctor = navItem.ControllerType.GetConstructor (navItem.ControllerConstructorTypes);
}
else {
// search for the default constructor
ctor = navItem.ControllerType.GetConstructor (System.Type.EmptyTypes);
}
// if we found the constructor
if (ctor != null)
{
//
UIViewController instance = null;
if (navItem.ControllerConstructorArgs.Length > 0) {
// instance the view controller
instance = ctor.Invoke (navItem.ControllerConstructorArgs) as UIViewController;
}
else {
// instance the view controller
instance = ctor.Invoke (null) as UIViewController;
}
if (instance != null) {
// save the object
navItem.Controller = instance;
// push the view controller onto the stack
navigationController.PushViewController (navItem.Controller, true);
}
else {
Console.WriteLine ("instance of view controller not created");
}
}
else
{
Console.WriteLine ("constructor not found");
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using System;
namespace Example_SharedResources.Code.Network
{
/// <summary>
/// Contains the potential network availability status
/// </summary>
public enum NetworkStatus
{
NotReachable,
ReachableViaCarrierDataNetwork,
ReachableViaWiFiNetwork
}
}

Просмотреть файл

@ -0,0 +1,154 @@
//using System;
//namespace Example_SharedResources.Code.Network
//{
// /// <summary>
// /// Reachability class, pulled from Miguel de Icaza's MonoTouch samples
// /// </summary>
// public static class Reachability
// {
// public static string HostName = "www.google.com";
//
// public static bool IsReachableWithoutRequiringConnection (NetworkStatus flags)
// {
// // Is it reachable with the current network configuration?
// bool isReachable = (flags & NetworkReachabilityFlags.Reachable) != 0;
//
// // Do we need a connection to reach it?
// bool noConnectionRequired = (flags & NetworkReachabilityFlags.ConnectionRequired) == 0;
//
// // Since the network stack will automatically try to get the WAN up,
// // probe that
// if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
// noConnectionRequired = true;
//
// return isReachable && noConnectionRequired;
// }
//
// // Is the host reachable with the current network configuration
// public static bool IsHostReachable (string host)
// {
// if (host == null || host.Length == 0)
// return false;
//
// using (var r = new NetworkReachability (host))
// {
// NetworkReachabilityFlags flags;
//
// if (r.TryGetFlags (out flags))
// {
// return IsReachableWithoutRequiringConnection (flags);
// }
// }
// return false;
// }
//
// //
// // Raised every time there is an interesting reachable event,
// // we do not even pass the info as to what changed, and
// // we lump all three status we probe into one
// //
// public static event EventHandler ReachabilityChanged;
//
// static void OnChange (NetworkStatus flags)
// {
// var h = ReachabilityChanged;
// if (h != null)
// h (null, EventArgs.Empty);
// }
//
// //
// // Returns true if it is possible to reach the AdHoc WiFi network
// // and optionally provides extra network reachability flags as the
// // out parameter
// //
// static NetworkStatus adHocWiFiNetworkReachability;
// public static bool IsAdHocWiFiNetworkAvailable (out NetworkStatus flags)
// {
// if (adHocWiFiNetworkReachability == null)
// {
// adHocWiFiNetworkReachability = new NetworkReachability (new IPAddress (new byte[] { 169, 254, 0, 0 }));
// adHocWiFiNetworkReachability.SetCallback (OnChange);
// adHocWiFiNetworkReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
// }
//
// if (!adHocWiFiNetworkReachability.TryGetFlags (out flags))
// return false;
//
// return IsReachableWithoutRequiringConnection (flags);
// }
//
// static NetworkStatus defaultRouteReachability;
// static bool IsNetworkAvaialable (out NetworkStatus flags)
// {
// if (defaultRouteReachability == null)
// {
// defaultRouteReachability = new NetworkReachability (new IPAddress (0));
// defaultRouteReachability.SetCallback (OnChange);
// defaultRouteReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
// }
// if (defaultRouteReachability.TryGetFlags (out flags))
// return false;
// return IsReachableWithoutRequiringConnection (flags);
// }
//
// static NetworkStatus remoteHostReachability;
// public static NetworkStatus RemoteHostStatus ()
// {
// NetworkReachabilityFlags flags;
// bool reachable;
//
// if (remoteHostReachability == null)
// {
// remoteHostReachability = new NetworkReachability (HostName);
//
// // Need to probe before we queue, or we wont get any meaningful values
// // this only happens when you create NetworkReachability from a hostname
// reachable = remoteHostReachability.TryGetFlags (out flags);
//
// remoteHostReachability.SetCallback (OnChange);
// remoteHostReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
// }
//
// else
// reachable = remoteHostReachability.TryGetFlags (out flags);
//
// if (!reachable)
// return NetworkStatus.NotReachable;
//
// if (!IsReachableWithoutRequiringConnection (flags))
// return NetworkStatus.NotReachable;
//
// if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
// return NetworkStatus.ReachableViaCarrierDataNetwork;
//
// return NetworkStatus.ReachableViaWiFiNetwork;
// }
//
// public static NetworkStatus InternetConnectionStatus ()
// {
// NetworkReachabilityFlags flags;
// bool defaultNetworkAvailable = IsNetworkAvaialable (out flags);
// if (defaultNetworkAvailable)
// {
// if ((flags & NetworkReachabilityFlags.IsDirect) != 0)
// return NetworkStatus.NotReachable;
// }
//
// else if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
// return NetworkStatus.ReachableViaCarrierDataNetwork;
// return NetworkStatus.ReachableViaWiFiNetwork;
// }
//
// public static NetworkStatus LocalWifiConnectionStatus ()
// {
// NetworkReachabilityFlags flags;
// if (IsAdHocWiFiNetworkAvailable (out flags))
// {
// if ((flags & NetworkReachabilityFlags.IsDirect) != 0)
// return NetworkStatus.ReachableViaWiFiNetwork;
// }
// return NetworkStatus.NotReachable;
// }
// }
//}
//

Двоичные данные
SharedResources/SharedResources/Default-Landscape~ipad.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 782 KiB

Двоичные данные
SharedResources/SharedResources/Default-Portrait~ipad.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 752 KiB

Двоичные данные
SharedResources/SharedResources/Default.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 141 KiB

Двоичные данные
SharedResources/SharedResources/Default@2x.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 638 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/114_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/29_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/50_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.8 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/512_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 318 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/57_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.1 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/58_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.3 KiB

Двоичные данные
SharedResources/SharedResources/Images/Icons/72_icon.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Просмотреть файл

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Shared Res.</string>
<key>CFBundleIconFiles</key>
<array>
<string>Images/Icons/57_icon.png</string>
<string>Images/Icons/114_icon.png</string>
<string>Images/Icons/72_icon.png</string>
<string>Images/Icons/29_icon.png</string>
<string>Images/Icons/58_icon.png</string>
<string>Images/Icons/50_icon.png</string>
<string>Images/Icons/512_icon.png</string>
</array>
<key>MinimumOSVersion</key>
<string>3.0</string>
<key>UIDeviceFamily</key>
<array>
<string>1</string>
</array>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,71 @@
using System;
using MonoTouch.UIKit;
using MonoTouch.AssetsLibrary;
using MonoTouch.Foundation;
using System.Collections.Generic;
namespace Example_SharedResources.Screens.iPhone.AVAssets
{
public class AssetEnumerationScreen : UITableViewController
{
// declare vars
string groupName = string.Empty;
List<ALAsset> assets = null;
AssetsDataSource dataSource = null;
public AssetEnumerationScreen (string groupName, List<ALAsset> assets)
{
this.groupName = groupName;
this.assets = assets;
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// set the title
Title = groupName;
// create our table source
dataSource = new AssetsDataSource(assets);
TableView.Source = dataSource;
}
/// <summary>
/// Simple data source to display the assets
/// </summary>
protected class AssetsDataSource : UITableViewSource
{
protected List<ALAsset> items;
public AssetsDataSource (List<ALAsset> items) { this.items = items; }
public override int NumberOfSections (UITableView tableView) { return 1; }
public override int RowsInSection (UITableView tableview, int section)
{
return items.Count;
}
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell ("AssetCell");
if(cell == null)
cell = new UITableViewCell (UITableViewCellStyle.Subtitle, "AssetCell");
// set the text
cell.TextLabel.Text = items[indexPath.Row].AssetType.ToString ();
cell.DetailTextLabel.Text = items[indexPath.Row].Date.ToString ();
// set the image
if(items[indexPath.Row].Thumbnail != null)
cell.ImageView.Image = UIImage.FromImage(items[indexPath.Row].Thumbnail);
return cell;
}
}
}
}

Просмотреть файл

@ -0,0 +1,132 @@
using System;
using MonoTouch.UIKit;
using MonoTouch.AssetsLibrary;
using MonoTouch.Foundation;
using System.Collections.Generic;
namespace Example_SharedResources.Screens.iPhone.AVAssets
{
public class AssetGroupEnumerationScreen : UITableViewController
{
// declare vars
protected ALAssetsLibrary assetsLibrary;
protected AssetGroupTableSource assetGroupTableSource;
protected List<ALAssetsGroup> groups = new List<ALAssetsGroup> ();
protected Dictionary<ALAssetsGroup, List<ALAsset>> assetGroups = new Dictionary<ALAssetsGroup, List<ALAsset>> ();
protected ALAssetsGroup currentGroup; //used to track the enumeration
public AssetGroupEnumerationScreen () { }
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "All Asset Groups";
// instantiate a reference to the shared assets library
assetsLibrary = new ALAssetsLibrary();
// enumerate the photo albums
assetsLibrary.Enumerate(ALAssetsGroupType.All
, GroupsEnumerator
, (NSError e) => { Console.WriteLine ("Could not enumerate albums: " + e.LocalizedDescription); });
}
// Called for each group that is enumerated
protected void GroupsEnumerator (ALAssetsGroup group, ref bool stop)
{
// when the enumeration is completed, this method is invoked with group set to null
if (group != null) {
Console.WriteLine ("Group found: " + group.Type.ToString ());
// don't stop, baby
stop = false;
// photos and videos. could also pass AllVideos, AllVideos, etc.
group.SetAssetsFilter (ALAssetsFilter.AllAssets);
if (group.Name != null)
Console.WriteLine("Group Name: " + group.Name);
// add the group to the assets dictionary
groups.Add(group);
assetGroups.Add(group, new List<ALAsset> ());
currentGroup = group;
// enumerate each asset within the group
group.Enumerate(AssetEnumerator);
} else {
Console.WriteLine ("Group enumeration completed.");
assetGroupTableSource = new AssetGroupTableSource (groups);
TableView.Source = assetGroupTableSource;
assetGroupTableSource.GroupSelected += (object sender, AssetGroupTableSource.GroupSelectedEventArgs e) => {
AssetEnumerationScreen assetScreen = new AssetEnumerationScreen (e.Group.Name, assetGroups[e.Group]);
NavigationController.PushViewController (assetScreen, true);
};
}
}
/// <summary>
/// A simple asset enumerator that adds the asset to our asset list
/// </summary>
protected void AssetEnumerator (ALAsset asset, int index, ref bool stop)
{
// when the enumeration is completed, this method is invoked with group set to null
if(asset != null) {
Console.WriteLine ("Found asset: " + index.ToString ());
// add the asset to the group list
assetGroups[currentGroup].Add (asset);
// keep going
stop = false;
//Console.WriteLine(asset.AssetType.ToString());
}
else
Console.WriteLine("Asset enumeration completed.");
}
/// <summary>
/// Simple data source to display the asset groups
/// </summary>
protected class AssetGroupTableSource : UITableViewSource
{
public event EventHandler<GroupSelectedEventArgs> GroupSelected;
protected List<ALAssetsGroup> groups;
public AssetGroupTableSource(List<ALAssetsGroup> groups) { this.groups = groups; }
public override int NumberOfSections (UITableView tableView) { return 1; }
public override int RowsInSection (UITableView tableview, int section) { return groups.Count; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell ("AlbumCell");
if(cell == null)
cell = new UITableViewCell (UITableViewCellStyle.Default, "AlbumCell");
cell.TextLabel.Text = groups[indexPath.Row].Name;
return cell;
}
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
// raise our event
var handler = GroupSelected;
if (handler != null)
handler (this, new GroupSelectedEventArgs (groups[indexPath.Row]));
}
public class GroupSelectedEventArgs : EventArgs
{
public ALAssetsGroup Group { get; set; }
public GroupSelectedEventArgs(ALAssetsGroup group) : base()
{ Group = group; }
}
}
}
}

Просмотреть файл

@ -0,0 +1,21 @@
using System;
using MonoTouch.UIKit;
using MonoTouch.AssetsLibrary;
namespace Example_SharedResources.Screens.iPhone.AVAssets
{
public class PhotoLibraryController : UITableViewController
{
public PhotoLibraryController ()
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
}
}
}

Просмотреть файл

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">123</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="341867654">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {280, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText"/>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<object class="NSColor" key="IBUIHighlightedColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblShakeStatus</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="341867654"/>
</object>
<int key="connectionID">9</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="341867654"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="341867654"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ShakeScreen</string>
<string>UIResponder</string>
<string>{{536, 503}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">9</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ShakeScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>lblShakeStatus</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>lblShakeStatus</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">lblShakeStatus</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">123</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Accelerometer
{
public partial class ShakeScreen : UIViewController
{
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public ShakeScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public ShakeScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public ShakeScreen () : base("ShakeScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Shake";
}
// Called by the iOS to determine if the controller can receive touches and action
// messages (such as motion events)
public override bool CanBecomeFirstResponder
{
get { return true; }
}
public override void ViewDidAppear (bool animated)
{
base.ViewWillAppear (animated);
// tell the iOS that we want motion events
BecomeFirstResponder();
}
public override void ViewWillDisappear (bool animated)
{
base.ViewWillDisappear (animated);
// be a good citizen and allow other controllers to become first responder
ResignFirstResponder();
}
// Called after the iOS determines the motion wasn't noise (such as walking up stairs).
public override void MotionEnded (UIEventSubtype motion, UIEvent evt)
{
Console.WriteLine("Motion Ended");
base.MotionEnded(motion, evt);
// if the motion was a shake
if(motion == UIEventSubtype.MotionShake) {
Console.Write("Shake Detected");
lblShakeStatus.Text = "Shook!";
}
}
}
}

Просмотреть файл

@ -0,0 +1,47 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Accelerometer {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("ShakeScreen")]
public partial class ShakeScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UILabel __mt_lblShakeStatus;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("lblShakeStatus")]
private MonoTouch.UIKit.UILabel lblShakeStatus {
get {
this.__mt_lblShakeStatus = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblShakeStatus")));
return this.__mt_lblShakeStatus;
}
set {
this.__mt_lblShakeStatus = value;
this.SetNativeField("lblShakeStatus", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,410 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">123</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="1010003696">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {55, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">X-Axis:</string>
<object class="NSColor" key="IBUITextColor" id="322902344">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<object class="NSColor" key="IBUIHighlightedColor" id="973294164">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="960941533">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{83, 20}, {168, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[data]</string>
<reference key="IBUITextColor" ref="322902344"/>
<reference key="IBUIHighlightedColor" ref="973294164"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="71950259">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 49}, {55, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Y-Axis:</string>
<reference key="IBUITextColor" ref="322902344"/>
<reference key="IBUIHighlightedColor" ref="973294164"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="336132908">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{83, 49}, {168, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[data]</string>
<reference key="IBUITextColor" ref="322902344"/>
<reference key="IBUIHighlightedColor" ref="973294164"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="60209370">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 78}, {55, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Z-Axis:</string>
<reference key="IBUITextColor" ref="322902344"/>
<reference key="IBUIHighlightedColor" ref="973294164"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="1038248436">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{83, 78}, {168, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[data]</string>
<reference key="IBUITextColor" ref="322902344"/>
<reference key="IBUIHighlightedColor" ref="973294164"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblX</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="960941533"/>
</object>
<int key="connectionID">15</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblY</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="336132908"/>
</object>
<int key="connectionID">16</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblZ</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="1038248436"/>
</object>
<int key="connectionID">17</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1010003696"/>
<reference ref="960941533"/>
<reference ref="71950259"/>
<reference ref="336132908"/>
<reference ref="60209370"/>
<reference ref="1038248436"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="1010003696"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="960941533"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="71950259"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="336132908"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="60209370"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="1038248436"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>10.IBViewBoundsToFrameTransform</string>
<string>11.IBPluginDependency</string>
<string>11.IBViewBoundsToFrameTransform</string>
<string>13.IBPluginDependency</string>
<string>13.IBViewBoundsToFrameTransform</string>
<string>14.IBPluginDependency</string>
<string>14.IBViewBoundsToFrameTransform</string>
<string>8.IBPluginDependency</string>
<string>8.IBViewBoundsToFrameTransform</string>
<string>9.IBPluginDependency</string>
<string>9.IBViewBoundsToFrameTransform</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>XYZDataScreen</string>
<string>UIResponder</string>
<string>{{612, 514}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUGgAABCRAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUKmAABCRAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABByAAAwpIAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABCsAAAwpIAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUGgAABBoAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUKmAABBoAAAA</bytes>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">17</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">XYZDataScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>lblX</string>
<string>lblY</string>
<string>lblZ</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>lblX</string>
<string>lblY</string>
<string>lblZ</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">lblX</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">lblY</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">lblZ</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">123</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Accelerometer
{
public partial class XYZDataScreen : UIViewController
{
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public XYZDataScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public XYZDataScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public XYZDataScreen () : base("XYZDataScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "XYZ Data";
// update interval is set in milliseconds
UIAccelerometer.SharedAccelerometer.UpdateInterval = 100;
// update the XYZ data when the accelerometer receives data
UIAccelerometer.SharedAccelerometer.Acceleration += (object sender, UIAccelerometerEventArgs e) => {
InvokeOnMainThread( () => {
lblX.Text = e.Acceleration.X.ToString();
lblY.Text = e.Acceleration.Y.ToString();
lblZ.Text = e.Acceleration.Z.ToString();
} );
};
}
}
}

Просмотреть файл

@ -0,0 +1,75 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Accelerometer {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("XYZDataScreen")]
public partial class XYZDataScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UILabel __mt_lblX;
private MonoTouch.UIKit.UILabel __mt_lblY;
private MonoTouch.UIKit.UILabel __mt_lblZ;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("lblX")]
private MonoTouch.UIKit.UILabel lblX {
get {
this.__mt_lblX = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblX")));
return this.__mt_lblX;
}
set {
this.__mt_lblX = value;
this.SetNativeField("lblX", value);
}
}
[MonoTouch.Foundation.Connect("lblY")]
private MonoTouch.UIKit.UILabel lblY {
get {
this.__mt_lblY = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblY")));
return this.__mt_lblY;
}
set {
this.__mt_lblY = value;
this.SetNativeField("lblY", value);
}
}
[MonoTouch.Foundation.Connect("lblZ")]
private MonoTouch.UIKit.UILabel lblZ {
get {
this.__mt_lblZ = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblZ")));
return this.__mt_lblZ;
}
set {
this.__mt_lblZ = value;
this.SetNativeField("lblZ", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,365 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">117</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="270277423">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {167, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Current Battery Level:</string>
<object class="NSColor" key="IBUITextColor" id="859647317">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="176587209">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 94}, {167, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Current Battery State:</string>
<reference key="IBUITextColor" ref="859647317"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="595074705">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 123}, {280, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[battery state]</string>
<reference key="IBUITextColor" ref="859647317"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUIProgressView" id="268885149">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{70, 55}, {178, 11}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<float key="IBUIProgress">0.5</float>
<int key="IBUIProgressViewStyle">1</int>
</object>
<object class="IBUILabel" id="554202719">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 49}, {42, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">0%</string>
<reference key="IBUITextColor" ref="859647317"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">1</int>
</object>
<object class="IBUILabel" id="541150240">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{256, 49}, {44, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">100%</string>
<reference key="IBUITextColor" ref="859647317"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">1</int>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">barBatteryLevel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="268885149"/>
</object>
<int key="connectionID">12</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblBatteryState</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="595074705"/>
</object>
<int key="connectionID">15</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="270277423"/>
<reference ref="554202719"/>
<reference ref="268885149"/>
<reference ref="541150240"/>
<reference ref="176587209"/>
<reference ref="595074705"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="270277423"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="268885149"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="554202719"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="541150240"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="176587209"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="595074705"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>13.IBPluginDependency</string>
<string>14.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>BatteryStatusScreen</string>
<string>UIResponder</string>
<string>{{530, 519}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">15</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">BatteryStatusScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>barBatteryLevel</string>
<string>lblBatteryState</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>barBatteryLevel</string>
<string>lblBatteryState</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">barBatteryLevel</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">lblBatteryState</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">117</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Battery
{
public partial class BatteryStatusScreen : UIViewController
{
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public BatteryStatusScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public BatteryStatusScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public BatteryStatusScreen () : base("BatteryStatusScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Battery";
// turn on battery monitoring
UIDevice.CurrentDevice.BatteryMonitoringEnabled = true;
// set the battery level on the progress bar
barBatteryLevel.Progress = UIDevice.CurrentDevice.BatteryLevel;
// the the battery state label
lblBatteryState.Text = UIDevice.CurrentDevice.BatteryState.ToString ();
// add a notification handler for battery level changes
NSNotificationCenter.DefaultCenter.AddObserver (UIDevice.BatteryLevelDidChangeNotification
, (NSNotification n) => {
barBatteryLevel.Progress = UIDevice.CurrentDevice.BatteryLevel;
n.Dispose();
});
// add a notification handler for battery state changes
NSNotificationCenter.DefaultCenter.AddObserver (UIDevice.BatteryStateDidChangeNotification
, (NSNotification n) => {
lblBatteryState.Text = UIDevice.CurrentDevice.BatteryState.ToString();
n.Dispose();
});
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Battery {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("BatteryStatusScreen")]
public partial class BatteryStatusScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UIProgressView __mt_barBatteryLevel;
private MonoTouch.UIKit.UILabel __mt_lblBatteryState;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("barBatteryLevel")]
private MonoTouch.UIKit.UIProgressView barBatteryLevel {
get {
this.__mt_barBatteryLevel = ((MonoTouch.UIKit.UIProgressView)(this.GetNativeField("barBatteryLevel")));
return this.__mt_barBatteryLevel;
}
set {
this.__mt_barBatteryLevel = value;
this.SetNativeField("barBatteryLevel", value);
}
}
[MonoTouch.Foundation.Connect("lblBatteryState")]
private MonoTouch.UIKit.UILabel lblBatteryState {
get {
this.__mt_lblBatteryState = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblBatteryState")));
return this.__mt_lblBatteryState;
}
set {
this.__mt_lblBatteryState = value;
this.SetNativeField("lblBatteryState", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,702 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">117</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="29"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIScrollView" id="820858636">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="205993418">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 52}, {90, 21}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">First Name:</string>
<object class="NSColor" key="IBUITextColor" id="151391588">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUITextField" id="127148092">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 47}, {182, 31}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="901114315">
<int key="NSID">2</int>
</object>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUILabel" id="626946551">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 86}, {90, 21}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Last Name:</string>
<reference key="IBUITextColor" ref="151391588"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUILabel" id="1040071119">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 120}, {129, 21}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Phone Numbers:</string>
<reference key="IBUITextColor" ref="151391588"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUITextField" id="463861608">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 81}, {182, 31}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="901114315"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUITableView" id="660886130">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 149}, {280, 129}}</string>
<reference key="NSSuperview" ref="820858636"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC43NQA</bytes>
<reference key="NSCustomColorSpace" ref="901114315"/>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIAlwaysBounceVertical">YES</bool>
<int key="IBUISeparatorStyle">1</int>
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
<float key="IBUIRowHeight">44</float>
<float key="IBUISectionHeaderHeight">22</float>
<float key="IBUISectionFooterHeight">22</float>
</object>
<object class="IBUIButton" id="805874615">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 286}, {280, 37}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont" id="338156989">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Save Changes</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="361323646">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="978821281">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUIButton" id="767020582">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{274, 395}, {29, 29}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<reference key="IBUIFont" ref="338156989"/>
<int key="IBUIButtonType">5</int>
<reference key="IBUIHighlightedTitleColor" ref="361323646"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="978821281"/>
</object>
<object class="IBUITextField" id="646436554">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 361}, {149, 31}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="901114315"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUILabel" id="183368557">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{41, 364}, {69, 21}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Label:</string>
<reference key="IBUITextColor" ref="151391588"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUILabel" id="643733746">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 335}, {197, 21}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Add New Phone Number:</string>
<reference key="IBUITextColor" ref="151391588"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUITextField" id="293178426">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 395}, {149, 31}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="901114315"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIKeyboardType">4</int>
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUILabel" id="303982945">
<reference key="NSNextResponder" ref="820858636"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{41, 398}, {69, 21}}</string>
<reference key="NSSuperview" ref="820858636"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Number:</string>
<reference key="IBUITextColor" ref="151391588"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
</object>
<string key="NSFrame">{{0, -32}, {320, 480}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="901114315"/>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnAddPhoneNumber</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="767020582"/>
</object>
<int key="connectionID">22</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnSaveChanges</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="805874615"/>
</object>
<int key="connectionID">23</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">tblPhoneNumbers</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="660886130"/>
</object>
<int key="connectionID">24</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">txtFirstName</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="127148092"/>
</object>
<int key="connectionID">25</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">txtLastName</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="463861608"/>
</object>
<int key="connectionID">26</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">txtPhoneLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="646436554"/>
</object>
<int key="connectionID">27</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">txtPhoneNumber</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="293178426"/>
</object>
<int key="connectionID">28</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">scrlMain</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="820858636"/>
</object>
<int key="connectionID">30</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="820858636"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="820858636"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="303982945"/>
<reference ref="293178426"/>
<reference ref="643733746"/>
<reference ref="183368557"/>
<reference ref="646436554"/>
<reference ref="767020582"/>
<reference ref="805874615"/>
<reference ref="660886130"/>
<reference ref="463861608"/>
<reference ref="1040071119"/>
<reference ref="626946551"/>
<reference ref="127148092"/>
<reference ref="205993418"/>
</object>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="205993418"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="127148092"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="626946551"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="1040071119"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="463861608"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="660886130"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="805874615"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="767020582"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="646436554"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">17</int>
<reference key="object" ref="183368557"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
<reference key="object" ref="643733746"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">18</int>
<reference key="object" ref="293178426"/>
<reference key="parent" ref="820858636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">19</int>
<reference key="object" ref="303982945"/>
<reference key="parent" ref="820858636"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>13.IBPluginDependency</string>
<string>14.IBPluginDependency</string>
<string>15.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>17.IBPluginDependency</string>
<string>18.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
<string>21.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>AddressBookScreen</string>
<string>UIResponder</string>
<string>{{714, 526}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">30</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AddressBookScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnAddPhoneNumber</string>
<string>btnSaveChanges</string>
<string>scrlMain</string>
<string>tblPhoneNumbers</string>
<string>txtFirstName</string>
<string>txtLastName</string>
<string>txtPhoneLabel</string>
<string>txtPhoneNumber</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnAddPhoneNumber</string>
<string>btnSaveChanges</string>
<string>scrlMain</string>
<string>tblPhoneNumbers</string>
<string>txtFirstName</string>
<string>txtLastName</string>
<string>txtPhoneLabel</string>
<string>txtPhoneNumber</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">btnAddPhoneNumber</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">btnSaveChanges</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">scrlMain</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">tblPhoneNumbers</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">txtFirstName</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">txtLastName</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">txtPhoneLabel</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">txtPhoneNumber</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">117</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,351 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.AddressBook;
using MonoTouch.AddressBookUI;
using System.Drawing;
namespace Example_SharedResources.Screens.iPhone.Contacts
{
public partial class AddressBookScreen : UIViewController
{
/// <summary>
/// Our address book picker control
/// </summary>
protected ABPeoplePickerNavigationController addressBookPicker;
/// <summary>
/// The table data source that will bind the phone numbers
/// </summary>
protected PhoneNumberTableSource tableDataSource;
/// <summary>
/// The ID of our person
/// </summary>
protected int contactID;
/// <summary>
/// Used to resize the scroll view to allow for keyboard
/// </summary>
RectangleF contentViewSize = RectangleF.Empty;
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public AddressBookScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public AddressBookScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public AddressBookScreen () : base("AddressBookScreen", null)
{
Initialize ();
}
void Initialize ()
{
contentViewSize = View.Frame;
scrlMain.ContentSize = contentViewSize.Size;
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Address Book";
// add a button to the nav bar that will select a contact to edit
UIButton btnSelectContact = UIButton.FromType (UIButtonType.RoundedRect);
btnSelectContact.SetTitle ("Select Contact", UIControlState.Normal);
NavigationItem.SetRightBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Action, SelectContact), false);
// wire up keyboard hiding
txtPhoneLabel.ShouldReturn += (t) => { t.ResignFirstResponder (); return true; };
txtPhoneNumber.ShouldReturn += (t) => { t.ResignFirstResponder (); return true; };
txtFirstName.ShouldReturn += (t) => { t.ResignFirstResponder (); return true; };
txtLastName.ShouldReturn += (t) => { t.ResignFirstResponder (); return true; };
// wire up event handlers
btnSaveChanges.TouchUpInside += BtnSaveChangesTouchUpInside;
btnAddPhoneNumber.TouchUpInside += BtnAddPhoneNumberTouchUpInside;
#region -= Sample code showing how to loop through all the records =-
//==== This block of code writes out each person contact in the address book and
// each phone number for that person to the console, just to illustrate the code
// neccessary to access each item
// instantiate a reference to the address book
using(ABAddressBook addressBook = new ABAddressBook ()) {
// if you want to subscribe to changes
addressBook.ExternalChange += (object sender, ExternalChangeEventArgs e) => {
// code to deal with changes
};
// for each record
foreach(ABRecord item in addressBook) {
Console.WriteLine(item.Type.ToString () + " " + item.Id);
// there are two possible record types, person and group
if (item.Type == ABRecordType.Person) {
// since we've already tested it to be a person, just create a shortcut to that
// type
ABPerson person = item as ABPerson;
Console.WriteLine (person.FirstName + " " + person.LastName);
// get the phone numbers
ABMultiValue<string> phones = person.GetPhones ();
foreach(ABMultiValueEntry<string> val in phones) {
Console.Write(val.Label + ": " + val.Value);
}
}
}
// save changes (if you were to have made any)
//addressBook.Save();
// or cancel them
//addressBook.Revert();
}
//====
#endregion
#region -= keyboard stuff =-
// wire up our keyboard events
NSNotificationCenter.DefaultCenter.AddObserver (
UIKeyboard.WillShowNotification, delegate (NSNotification n) { KeyboardOpenedOrClosed (n, "Open"); });
NSNotificationCenter.DefaultCenter.AddObserver (
UIKeyboard.WillHideNotification, delegate (NSNotification n) { KeyboardOpenedOrClosed (n, "Close"); });
#endregion
}
protected void BtnAddPhoneNumberTouchUpInside (object sender, EventArgs e)
{
// get a reference to the contact
using(ABAddressBook addressBook = new ABAddressBook ())
{
ABPerson contact = addressBook.GetPerson (contactID);
// get the phones and copy them to a mutable set of multivalues (so we can edit)
ABMutableMultiValue<string> phones = contact.GetPhones ().ToMutableMultiValue ();
// add the phone number to the phones via the multivalue.Add method
phones.Add (new NSString (txtPhoneLabel.Text), new NSString (txtPhoneNumber.Text));
// attach the phones back to the contact
contact.SetPhones (phones);
// save the address book changes
addressBook.Save ();
// show an alert, letting the user know the number addition was successful
new UIAlertView ("Alert", "Phone Number Added", null, "OK", null).Show();
// update the page
PopulatePage (contact);
// we have to call reload to refresh the table because the action didn't originate
// from the table.
tblPhoneNumbers.ReloadData ();
}
}
// Called when a phone number is swiped for deletion. Illustrates how to delete a multivalue property
protected void DeletePhoneNumber (int phoneNumberID)
{
using(ABAddressBook addressBook = new ABAddressBook ()) {
ABPerson contact = addressBook.GetPerson (contactID);
// get the phones and copy them to a mutable set of multivalues (so we can edit)
ABMutableMultiValue<string> phones = contact.GetPhones ().ToMutableMultiValue ();
// loop backwards and delete the phone number
for (int i = phones.Count - 1; i >= 0 ; i--) {
if (phones[i].Identifier == phoneNumberID)
phones.RemoveAt(i);
}
// attach the phones back to the contact
contact.SetPhones (phones);
// save the changes
addressBook.Save ();
// show an alert, letting the user know the number deletion was successful
new UIAlertView ("Alert", "Phone Number Deleted", null, "OK", null).Show ();
// repopulate the page
PopulatePage (contact);
}
}
protected void BtnSaveChangesTouchUpInside (object sender, EventArgs e)
{
}
protected void PopulatePage (ABPerson contact)
{
// save the ID of our person
contactID = contact.Id;
// set the data on the page
txtFirstName.Text = contact.FirstName;
txtLastName.Text = contact.LastName;
tableDataSource = new AddressBookScreen.PhoneNumberTableSource (contact.GetPhones ());
tblPhoneNumbers.Source = tableDataSource;
// wire up our delete clicked handler
tableDataSource.DeleteClicked +=
(object sender, PhoneNumberTableSource.PhoneNumberClickedEventArgs e) => { DeletePhoneNumber (e.PhoneNumberID); };
}
// Opens up a contact picker and then populates the screen, based on the contact chosen
protected void SelectContact (object s, EventArgs e)
{
// create the picker control
addressBookPicker = new ABPeoplePickerNavigationController ();
NavigationController.PresentModalViewController (addressBookPicker, true);
// wire up the cancelled event to dismiss the picker
addressBookPicker.Cancelled += (sender, eventArgs) => { NavigationController.DismissModalViewControllerAnimated (true); };
// when a contact is chosen, populate the page and then dismiss the picker
addressBookPicker.SelectPerson += (object sender, ABPeoplePickerSelectPersonEventArgs args) => {
PopulatePage (args.Person);
NavigationController.DismissModalViewControllerAnimated (true);
};
}
#region -= table binding stuff (not important to understanding the address API) =-
/// <summary>
/// A simple table view source to bind our phone numbers to the table
/// </summary>
protected class PhoneNumberTableSource : UITableViewSource
{
public event EventHandler<PhoneNumberClickedEventArgs> DeleteClicked;
protected ABMultiValue<string> phoneNumbers { get; set; }
public PhoneNumberTableSource(ABMultiValue<string> phoneNumbers)
{ this.phoneNumbers = phoneNumbers; }
public override int NumberOfSections (UITableView tableView) { return 1; }
public override int RowsInSection (UITableView tableview, int section) { return phoneNumbers.Count; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
EditablePhoneTableCell cell = tableView.DequeueReusableCell ("PhoneCell") as EditablePhoneTableCell;
if(cell == null)
cell = new EditablePhoneTableCell ("PhoneCell");
cell.PhoneLabel = phoneNumbers[indexPath.Row].Label.ToString ().Replace ("_$!<", "").Replace (">!$_", "");
cell.PhoneNumber = phoneNumbers[indexPath.Row].Value.ToString ();
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
return cell;
}
public override bool CanEditRow (UITableView tableView, NSIndexPath indexPath) { return true; }
public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath)
{ return UITableViewCellEditingStyle.Delete; }
public override void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
{
if(editingStyle == UITableViewCellEditingStyle.Delete) {
if (DeleteClicked != null)
DeleteClicked (this, new PhoneNumberClickedEventArgs(phoneNumbers[indexPath.Row].Identifier));
}
}
// We use this so we can pass the id of the phone number that was clicked along with the event
public class PhoneNumberClickedEventArgs : EventArgs
{
public int PhoneNumberID { get; set; }
public PhoneNumberClickedEventArgs(int phoneNumberID) : base()
{ PhoneNumberID = phoneNumberID; }
}
}
/// <summary>
/// A simple, two text box cell, that will hold our phone label, and our phone number.
/// </summary>
protected class EditablePhoneTableCell : UITableViewCell
{
// label and phone number text boxes
UITextField txtLabel = new UITextField(new RectangleF(10, 5, 110, 33));
UITextField txtPhoneNumber = new UITextField(new RectangleF(130, 5, 140, 33));
// properties
public string PhoneLabel { get { return txtLabel.Text; } set { txtLabel.Text = value; } }
public string PhoneNumber { get { return txtPhoneNumber.Text; } set { txtPhoneNumber.Text = value; } }
public EditablePhoneTableCell(string reuseIdentifier) : base(UITableViewCellStyle.Default, reuseIdentifier)
{
AddSubview(txtLabel);
AddSubview(txtPhoneNumber);
txtLabel.ReturnKeyType = UIReturnKeyType.Done;
txtLabel.BorderStyle = UITextBorderStyle.Line;
txtLabel.ShouldReturn += (t) => { t.ResignFirstResponder(); return true; };
txtPhoneNumber.ReturnKeyType= UIReturnKeyType.Done;
txtPhoneNumber.BorderStyle = UITextBorderStyle.Line;
txtPhoneNumber.ShouldReturn += (t) => { t.ResignFirstResponder(); return true; };
}
}
#endregion
#region -= keyboard/screen resizing =-
/// <summary>
/// resizes the view when the keyboard comes up or goes away, allows our scroll view to work
/// </summary>
protected void KeyboardOpenedOrClosed (NSNotification n, string openOrClose)
{
// if it's opening
if (openOrClose == "Open")
{
Console.WriteLine ("Keyboard opening");
// declare vars
RectangleF kbdFrame = UIKeyboard.BoundsFromNotification (n);
double animationDuration = UIKeyboard.AnimationDurationFromNotification (n);
RectangleF newFrame = contentViewSize;
// resize our frame depending on whether the keyboard pops in or out
newFrame.Height -= kbdFrame.Height;
// apply the size change
UIView.BeginAnimations ("ResizeForKeyboard");
UIView.SetAnimationDuration (animationDuration);
scrlMain.Frame = newFrame;
UIView.CommitAnimations ();
} else // if it's closing, resize
{
// declare vars
double animationDuration = UIKeyboard.AnimationDurationFromNotification (n);
// apply the size change
UIView.BeginAnimations ("ResizeForKeyboard");
UIView.SetAnimationDuration (animationDuration);
scrlMain.Frame = contentViewSize;
UIView.CommitAnimations ();
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,145 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Contacts {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("AddressBookScreen")]
public partial class AddressBookScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UIButton __mt_btnAddPhoneNumber;
private MonoTouch.UIKit.UIButton __mt_btnSaveChanges;
private MonoTouch.UIKit.UITableView __mt_tblPhoneNumbers;
private MonoTouch.UIKit.UITextField __mt_txtFirstName;
private MonoTouch.UIKit.UITextField __mt_txtLastName;
private MonoTouch.UIKit.UITextField __mt_txtPhoneLabel;
private MonoTouch.UIKit.UITextField __mt_txtPhoneNumber;
private MonoTouch.UIKit.UIScrollView __mt_scrlMain;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("btnAddPhoneNumber")]
private MonoTouch.UIKit.UIButton btnAddPhoneNumber {
get {
this.__mt_btnAddPhoneNumber = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnAddPhoneNumber")));
return this.__mt_btnAddPhoneNumber;
}
set {
this.__mt_btnAddPhoneNumber = value;
this.SetNativeField("btnAddPhoneNumber", value);
}
}
[MonoTouch.Foundation.Connect("btnSaveChanges")]
private MonoTouch.UIKit.UIButton btnSaveChanges {
get {
this.__mt_btnSaveChanges = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnSaveChanges")));
return this.__mt_btnSaveChanges;
}
set {
this.__mt_btnSaveChanges = value;
this.SetNativeField("btnSaveChanges", value);
}
}
[MonoTouch.Foundation.Connect("tblPhoneNumbers")]
private MonoTouch.UIKit.UITableView tblPhoneNumbers {
get {
this.__mt_tblPhoneNumbers = ((MonoTouch.UIKit.UITableView)(this.GetNativeField("tblPhoneNumbers")));
return this.__mt_tblPhoneNumbers;
}
set {
this.__mt_tblPhoneNumbers = value;
this.SetNativeField("tblPhoneNumbers", value);
}
}
[MonoTouch.Foundation.Connect("txtFirstName")]
private MonoTouch.UIKit.UITextField txtFirstName {
get {
this.__mt_txtFirstName = ((MonoTouch.UIKit.UITextField)(this.GetNativeField("txtFirstName")));
return this.__mt_txtFirstName;
}
set {
this.__mt_txtFirstName = value;
this.SetNativeField("txtFirstName", value);
}
}
[MonoTouch.Foundation.Connect("txtLastName")]
private MonoTouch.UIKit.UITextField txtLastName {
get {
this.__mt_txtLastName = ((MonoTouch.UIKit.UITextField)(this.GetNativeField("txtLastName")));
return this.__mt_txtLastName;
}
set {
this.__mt_txtLastName = value;
this.SetNativeField("txtLastName", value);
}
}
[MonoTouch.Foundation.Connect("txtPhoneLabel")]
private MonoTouch.UIKit.UITextField txtPhoneLabel {
get {
this.__mt_txtPhoneLabel = ((MonoTouch.UIKit.UITextField)(this.GetNativeField("txtPhoneLabel")));
return this.__mt_txtPhoneLabel;
}
set {
this.__mt_txtPhoneLabel = value;
this.SetNativeField("txtPhoneLabel", value);
}
}
[MonoTouch.Foundation.Connect("txtPhoneNumber")]
private MonoTouch.UIKit.UITextField txtPhoneNumber {
get {
this.__mt_txtPhoneNumber = ((MonoTouch.UIKit.UITextField)(this.GetNativeField("txtPhoneNumber")));
return this.__mt_txtPhoneNumber;
}
set {
this.__mt_txtPhoneNumber = value;
this.SetNativeField("txtPhoneNumber", value);
}
}
[MonoTouch.Foundation.Connect("scrlMain")]
private MonoTouch.UIKit.UIScrollView scrlMain {
get {
this.__mt_scrlMain = ((MonoTouch.UIKit.UIScrollView)(this.GetNativeField("scrlMain")));
return this.__mt_scrlMain;
}
set {
this.__mt_scrlMain = value;
this.SetNativeField("scrlMain", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,419 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">117</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIButton" id="1034431358">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {280, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont" id="1008682491">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Choose Contact</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="212655654">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="579583480">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUIButton" id="975009788">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 123}, {280, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<reference key="IBUIFont" ref="1008682491"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">View Selected Contact Details</string>
<reference key="IBUIHighlightedTitleColor" ref="212655654"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="579583480"/>
</object>
<object class="IBUILabel" id="587999014">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 65}, {90, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">First Name:</string>
<object class="NSColor" key="IBUITextColor" id="277702568">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUILabel" id="1033189337">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 94}, {90, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Last Name:</string>
<reference key="IBUITextColor" ref="277702568"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUILabel" id="983574447">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 65}, {182, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[first name]</string>
<object class="NSColor" key="IBUITextColor" id="817429638">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC4yAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="289625753">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 94}, {182, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[last name]</string>
<reference key="IBUITextColor" ref="817429638"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnChooseContact</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="1034431358"/>
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblFirstName</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="983574447"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblLastName</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="289625753"/>
</object>
<int key="connectionID">15</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnViewSelectedContact</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="975009788"/>
</object>
<int key="connectionID">21</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1034431358"/>
<reference ref="587999014"/>
<reference ref="1033189337"/>
<reference ref="983574447"/>
<reference ref="289625753"/>
<reference ref="975009788"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="1034431358"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="587999014"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="1033189337"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="983574447"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="289625753"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="975009788"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ContactPickerScreen</string>
<string>UIResponder</string>
<string>{{485, 526}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">21</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ContactPickerScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnChooseContact</string>
<string>btnViewSelectedContact</string>
<string>lblFirstName</string>
<string>lblLastName</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnChooseContact</string>
<string>btnViewSelectedContact</string>
<string>lblFirstName</string>
<string>lblLastName</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">btnChooseContact</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">btnViewSelectedContact</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">lblFirstName</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">lblLastName</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">117</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.AddressBookUI;
using MonoTouch.AddressBook;
namespace Example_SharedResources.Screens.iPhone.Contacts
{
public partial class ContactPickerScreen : UIViewController
{
// you must declare the Address Book Controllers at the class-level, otherwise they'll get
// garbage collected when the method that creates them returns. When the events fire, the handlers
// will have also been GC'd
protected ABPeoplePickerNavigationController addressBookPicker;
protected ABPersonViewController addressBookViewPerson;
protected ABPerson selectedPerson = null;
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public ContactPickerScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public ContactPickerScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public ContactPickerScreen () : base("ContactPickerScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Address Book Controllers";
// displays the contact picker controller when the choose contact button is clicked
btnChooseContact.TouchUpInside += (s, e) => {
// create the picker control
addressBookPicker = new ABPeoplePickerNavigationController();
// in this case, we can call present modal view controller from the nav controller,
// but we could have just as well called PresentModalViewController(...)
NavigationController.PresentModalViewController(addressBookPicker, true);
// when cancel is clicked, dismiss the controller
addressBookPicker.Cancelled += (sender, eventArgs) => { NavigationController.DismissModalViewControllerAnimated(true); };
// when a contact is chosen, populate the page with details and dismiss the controller
addressBookPicker.SelectPerson += (object sender, ABPeoplePickerSelectPersonEventArgs args) => {
selectedPerson = args.Person;
lblFirstName.Text = selectedPerson.FirstName;
lblLastName.Text = selectedPerson.LastName;
NavigationController.DismissModalViewControllerAnimated(true);
};
};
// shows the view/edit contact controller when the button is clicked
btnViewSelectedContact.TouchUpInside += (s, e) => {
// if a contact hasn't been selected, show an alert and return out
if(selectedPerson == null)
{
new UIAlertView ("Alert", "You must select a contact first.", null, "OK", null).Show ();
return;
}
// instantiate a new controller
addressBookViewPerson = new ABPersonViewController ();
// set the contact to display
addressBookViewPerson.DisplayedPerson = selectedPerson;
// allow editing
addressBookViewPerson.AllowsEditing = true;
// push the controller onto the nav stack. the view/edit controller requires a nav
// controller and handles it's own dismissal
NavigationController.PushViewController (addressBookViewPerson, true);
};
}
}
}

Просмотреть файл

@ -0,0 +1,89 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Contacts {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("ContactPickerScreen")]
public partial class ContactPickerScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UIButton __mt_btnChooseContact;
private MonoTouch.UIKit.UILabel __mt_lblFirstName;
private MonoTouch.UIKit.UILabel __mt_lblLastName;
private MonoTouch.UIKit.UIButton __mt_btnViewSelectedContact;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("btnChooseContact")]
private MonoTouch.UIKit.UIButton btnChooseContact {
get {
this.__mt_btnChooseContact = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnChooseContact")));
return this.__mt_btnChooseContact;
}
set {
this.__mt_btnChooseContact = value;
this.SetNativeField("btnChooseContact", value);
}
}
[MonoTouch.Foundation.Connect("lblFirstName")]
private MonoTouch.UIKit.UILabel lblFirstName {
get {
this.__mt_lblFirstName = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblFirstName")));
return this.__mt_lblFirstName;
}
set {
this.__mt_lblFirstName = value;
this.SetNativeField("lblFirstName", value);
}
}
[MonoTouch.Foundation.Connect("lblLastName")]
private MonoTouch.UIKit.UILabel lblLastName {
get {
this.__mt_lblLastName = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblLastName")));
return this.__mt_lblLastName;
}
set {
this.__mt_lblLastName = value;
this.SetNativeField("lblLastName", value);
}
}
[MonoTouch.Foundation.Connect("btnViewSelectedContact")]
private MonoTouch.UIKit.UIButton btnViewSelectedContact {
get {
this.__mt_btnViewSelectedContact = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnViewSelectedContact")));
return this.__mt_btnViewSelectedContact;
}
set {
this.__mt_btnViewSelectedContact = value;
this.SetNativeField("btnViewSelectedContact", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,428 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">117</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIButton" id="424015302">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 99}, {280, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont" id="873036388">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Create New Contact</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="897842003">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="989047981">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUIButton" id="712391844">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 144}, {280, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<reference key="IBUIFont" ref="873036388"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Prompt for New/Add to Existing</string>
<reference key="IBUIHighlightedTitleColor" ref="897842003"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="989047981"/>
</object>
<object class="IBUITextField" id="82607226">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 20}, {182, 31}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">Jane</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="303304975">
<int key="NSID">2</int>
</object>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUILabel" id="708621021">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 25}, {90, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">First Name:</string>
<object class="NSColor" key="IBUITextColor" id="106714824">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
<object class="IBUITextField" id="664854240">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{118, 54}, {182, 31}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">Doe</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="303304975"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUILabel" id="185646721">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 59}, {90, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Last Name:</string>
<reference key="IBUITextColor" ref="106714824"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="303304975"/>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnCreateNewContact</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="424015302"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnPromptForUnknown</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="712391844"/>
</object>
<int key="connectionID">15</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">txtFirstName</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="82607226"/>
</object>
<int key="connectionID">16</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">txtLastName</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="664854240"/>
</object>
<int key="connectionID">17</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="82607226"/>
<reference ref="708621021"/>
<reference ref="664854240"/>
<reference ref="185646721"/>
<reference ref="424015302"/>
<reference ref="712391844"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="424015302"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="82607226"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="708621021"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="664854240"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="185646721"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="712391844"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>13.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NewAndUnknownContactScreen</string>
<string>UIResponder</string>
<string>{{479, 676}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">17</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NewAndUnknownContactScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnCreateNewContact</string>
<string>btnPromptForUnknown</string>
<string>txtFirstName</string>
<string>txtLastName</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnCreateNewContact</string>
<string>btnPromptForUnknown</string>
<string>txtFirstName</string>
<string>txtLastName</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">btnCreateNewContact</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">btnPromptForUnknown</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">txtFirstName</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">txtLastName</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">117</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.AddressBook;
using MonoTouch.AddressBookUI;
namespace Example_SharedResources.Screens.iPhone.Contacts
{
public partial class NewAndUnknownContactScreen : UIViewController
{
// you must declare the Address Book Controllers at the class-level, otherwise they'll get
// garbage collected when the method that creates them returns. When the events fire, the handlers
// will have also been GC'd
protected ABNewPersonViewController addressBookNewPerson;
protected ABUnknownPersonViewController addressBookUnknownPerson;
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public NewAndUnknownContactScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public NewAndUnknownContactScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public NewAndUnknownContactScreen () : base("NewAndUnknownContactScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "New and Unknown Contacts";
// shows the create new contact screen when the button is clicked
btnCreateNewContact.TouchUpInside += (s, e) => {
// instantiate a new ABNewPersonViewController
addressBookNewPerson = new ABNewPersonViewController ();
// create a person from the fields on the screen so we can prepopulate the
// controller with data
ABPerson person = new ABPerson ();
person.FirstName = txtFirstName.Text;
person.LastName = txtLastName.Text;
// prepopulate the controller with the person
addressBookNewPerson.DisplayedPerson = person;
// push the controller onto the nav stack
NavigationController.PushViewController (addressBookNewPerson, true);
// wire up the new person complete handler to pop the controller off the stack
addressBookNewPerson.NewPersonComplete += (object sender, ABNewPersonCompleteEventArgs args) => {
// if the "done" button was clicked, rather than cancel
if(args.Completed) {
// show an alert view with the new contact ID
new UIAlertView ("Alert", "New contact created, ID: " + args.Person.Id.ToString(), null, "OK", null).Show();
}
// pop the controller off the stack
NavigationController.PopViewControllerAnimated (true);
};
};
//
btnPromptForUnknown.TouchUpInside += (s, e) => {
// instantiate a new unknown person controller
addressBookUnknownPerson = new ABUnknownPersonViewController ();
// create a person from the fields on the screen so we can prepopulate the
// controller with data
ABPerson person = new ABPerson ();
person.FirstName = txtFirstName.Text;
person.LastName = txtLastName.Text;
// prepopulate the controller with the person
addressBookUnknownPerson.DisplayedPerson = person;
// allow adding to address book
addressBookUnknownPerson.AllowsAddingToAddressBook = true;
// allow them to share the contact, make calls, click on urls, etc in the controller
addressBookUnknownPerson.AllowsActions = true;
// push the controller onto the nav stack
NavigationController.PushViewController (addressBookUnknownPerson, true);
// handle the person created event
addressBookUnknownPerson.PersonCreated += (object sender, ABUnknownPersonCreatedEventArgs args) => {
Console.WriteLine ("PersonCreated event raised");
// this dialog can be cancelled out of as well, but there is no Completed property, so we
// just have to do a null check
if(args.Person != null) {
// show an alert view with the new contact ID
new UIAlertView ("Alert", "New contact created, ID: " + args.Person.Id.ToString (), null, "OK", null).Show ();
}
};
// you can also handle the perform default action event to determine whether or not the action should be allowed
// to be perfomed.
//addressBookUnknownPerson.PerformDefaultAction += (object sender, ABPersonViewPerformDefaultActionEventArgs args) => {
// if(args.Property == ABPersonProperty.Url)
// {
// args.ShouldPerformDefaultAction = false;
// }
//};
};
}
}
}

Просмотреть файл

@ -0,0 +1,89 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Contacts {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("NewAndUnknownContactScreen")]
public partial class NewAndUnknownContactScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UIButton __mt_btnCreateNewContact;
private MonoTouch.UIKit.UIButton __mt_btnPromptForUnknown;
private MonoTouch.UIKit.UITextField __mt_txtFirstName;
private MonoTouch.UIKit.UITextField __mt_txtLastName;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("btnCreateNewContact")]
private MonoTouch.UIKit.UIButton btnCreateNewContact {
get {
this.__mt_btnCreateNewContact = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnCreateNewContact")));
return this.__mt_btnCreateNewContact;
}
set {
this.__mt_btnCreateNewContact = value;
this.SetNativeField("btnCreateNewContact", value);
}
}
[MonoTouch.Foundation.Connect("btnPromptForUnknown")]
private MonoTouch.UIKit.UIButton btnPromptForUnknown {
get {
this.__mt_btnPromptForUnknown = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnPromptForUnknown")));
return this.__mt_btnPromptForUnknown;
}
set {
this.__mt_btnPromptForUnknown = value;
this.SetNativeField("btnPromptForUnknown", value);
}
}
[MonoTouch.Foundation.Connect("txtFirstName")]
private MonoTouch.UIKit.UITextField txtFirstName {
get {
this.__mt_txtFirstName = ((MonoTouch.UIKit.UITextField)(this.GetNativeField("txtFirstName")));
return this.__mt_txtFirstName;
}
set {
this.__mt_txtFirstName = value;
this.SetNativeField("txtFirstName", value);
}
}
[MonoTouch.Foundation.Connect("txtLastName")]
private MonoTouch.UIKit.UITextField txtLastName {
get {
this.__mt_txtLastName = ((MonoTouch.UIKit.UITextField)(this.GetNativeField("txtLastName")));
return this.__mt_txtLastName;
}
set {
this.__mt_txtLastName = value;
this.SetNativeField("txtLastName", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">123</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="519091232">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {180, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Application Home Path:</string>
<object class="NSColor" key="IBUITextColor" id="24623919">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<object class="NSColor" key="IBUIHighlightedColor" id="692952449">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="701526462">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{34, 49}, {266, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">[url]</string>
<reference key="IBUITextColor" ref="24623919"/>
<reference key="IBUIHighlightedColor" ref="692952449"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">lblAppHomeDir</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="701526462"/>
</object>
<int key="connectionID">10</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="519091232"/>
<reference ref="701526462"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="519091232"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="701526462"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>8.IBViewBoundsToFrameTransform</string>
<string>9.IBPluginDependency</string>
<string>9.IBViewBoundsToFrameTransform</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>FileSystemInfo</string>
<string>UIResponder</string>
<string>{{624, 505}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUGgAABBoAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABByAAAwjAAAA</bytes>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">10</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">FileSystemInfo</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>lblAppHomeDir</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>lblAppHomeDir</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">lblAppHomeDir</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">123</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.FileSystem
{
public partial class FileSystemInfo : UIViewController
{
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public FileSystemInfo (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public FileSystemInfo (NSCoder coder) : base(coder)
{
Initialize ();
}
public FileSystemInfo () : base("FileSystemInfo", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "File System";
lblAppHomeDir.Text = NSBundle.MainBundle.BundlePath;
//Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
}
}
}

Просмотреть файл

@ -0,0 +1,47 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.FileSystem {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("FileSystemInfo")]
public partial class FileSystemInfo {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UILabel __mt_lblAppHomeDir;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("lblAppHomeDir")]
private MonoTouch.UIKit.UILabel lblAppHomeDir {
get {
this.__mt_lblAppHomeDir = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("lblAppHomeDir")));
return this.__mt_lblAppHomeDir;
}
set {
this.__mt_lblAppHomeDir = value;
this.SetNativeField("lblAppHomeDir", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,81 @@
using System;
using MonoTouch.UIKit;
using Example_SharedResources.Code;
using System.Collections.Generic;
namespace Example_SharedResources.Screens.iPhone.Home
{
public class HomeNavController : UITableViewController
{
// declare vars
List<NavItemGroup> navItems = new List<NavItemGroup>();
NavItemTableSource tableSource;
public HomeNavController () : base(UITableViewStyle.Grouped)
{
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
// hide the nav bar when this controller appears
this.NavigationController.SetNavigationBarHidden (true, true);
}
public override void ViewWillDisappear (bool animated)
{
base.ViewWillDisappear (animated);
// show the nav bar when other controllers appear
this.NavigationController.SetNavigationBarHidden (false, true);
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// declare vars
NavItemGroup navGroup;
// create the navigation items
navGroup = new NavItemGroup ("Network");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("Activity Indicator", "", typeof (Network.ActivityIndicatorScreen)));
navGroup = new NavItemGroup ("Battery");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("Status", "", typeof (Battery.BatteryStatusScreen)));
navGroup = new NavItemGroup ("Contacts/Address Book");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("Contact Picker/View Contact", "", typeof (Contacts.ContactPickerScreen)));
navGroup.Items.Add (new NavItem ("New/Unknown Contact", "", typeof (Contacts.NewAndUnknownContactScreen)));
navGroup.Items.Add (new NavItem ("Address Book", "", typeof (Contacts.AddressBookScreen)));
navGroup = new NavItemGroup ("Assets Library");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("Photo/Video Album List", "", typeof (AVAssets.AssetGroupEnumerationScreen)));
navGroup = new NavItemGroup ("Photos and Camera Controllers");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("Test Overlay", "", typeof (Photos.TestCameraOverlayController)));
navGroup.Items.Add (new NavItem ("Photo/Camera Picker", "", typeof (Photos.ImagePickerScreen)));
navGroup.Items.Add (new NavItem ("Custom Camera Overlay", "", typeof (Photos.CustomCameraViewScreen)));
navGroup = new NavItemGroup ("Accelerometer");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("XYZ Data", "", typeof (Accelerometer.XYZDataScreen)));
navGroup.Items.Add (new NavItem ("Shake Motion", "", typeof (Accelerometer.ShakeScreen)));
navGroup = new NavItemGroup ("File System");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("File system info", "", typeof (FileSystem.FileSystemInfo)));
// create a table source from our nav items
tableSource = new NavItemTableSource (this.NavigationController, navItems);
// set the source on the table to our data source
base.TableView.Source = tableSource;
}
}
}

Просмотреть файл

@ -0,0 +1,324 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">123</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="4671699">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {142, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Network Activity 1:</string>
<object class="NSColor" key="IBUITextColor" id="1045992713">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUISwitch" id="546144579">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{206, 17}, {94, 27}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
</object>
<object class="IBUILabel" id="167804513">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 52}, {142, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Network Activity 2:</string>
<reference key="IBUITextColor" ref="1045992713"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUISwitch" id="619278935">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{206, 49}, {94, 27}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">swtchActivityIndicator1</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="546144579"/>
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">swtchActivityIndicator2</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="619278935"/>
</object>
<int key="connectionID">14</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="4671699"/>
<reference ref="546144579"/>
<reference ref="167804513"/>
<reference ref="619278935"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="4671699"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="546144579"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="167804513"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="619278935"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>11.IBViewBoundsToFrameTransform</string>
<string>12.IBPluginDependency</string>
<string>12.IBViewBoundsToFrameTransform</string>
<string>8.IBPluginDependency</string>
<string>8.IBViewBoundsToFrameTransform</string>
<string>9.IBPluginDependency</string>
<string>9.IBViewBoundsToFrameTransform</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActivityIndicatorScreen</string>
<string>UIResponder</string>
<string>{{579, 620}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABByAAAwjAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABDUwAAwjwAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUGgAABBoAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUNOAABBiAAAA</bytes>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">14</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ActivityIndicatorScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>swtchActivityIndicator1</string>
<string>swtchActivityIndicator2</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>swtchActivityIndicator1</string>
<string>swtchActivityIndicator2</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">swtchActivityIndicator1</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">swtchActivityIndicator2</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">123</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Network
{
public partial class ActivityIndicatorScreen : UIViewController
{
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public ActivityIndicatorScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public ActivityIndicatorScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public ActivityIndicatorScreen () : base("ActivityIndicatorScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.Title = "Network Activity Indicator";
// show/hide the network activity indicator based on the switch value
this.swtchActivityIndicator1.ValueChanged += (s, e) => {
(UIApplication.SharedApplication.Delegate as AppDelegate).SetNetworkActivityIndicator (this.swtchActivityIndicator1.On);
};
// show/hide the network activity indicator based on the switch value
this.swtchActivityIndicator2.ValueChanged += (s, e) => {
(UIApplication.SharedApplication.Delegate as AppDelegate).SetNetworkActivityIndicator (this.swtchActivityIndicator2.On);
};
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Network {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("ActivityIndicatorScreen")]
public partial class ActivityIndicatorScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UISwitch __mt_swtchActivityIndicator1;
private MonoTouch.UIKit.UISwitch __mt_swtchActivityIndicator2;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("swtchActivityIndicator1")]
private MonoTouch.UIKit.UISwitch swtchActivityIndicator1 {
get {
this.__mt_swtchActivityIndicator1 = ((MonoTouch.UIKit.UISwitch)(this.GetNativeField("swtchActivityIndicator1")));
return this.__mt_swtchActivityIndicator1;
}
set {
this.__mt_swtchActivityIndicator1 = value;
this.SetNativeField("swtchActivityIndicator1", value);
}
}
[MonoTouch.Foundation.Connect("swtchActivityIndicator2")]
private MonoTouch.UIKit.UISwitch swtchActivityIndicator2 {
get {
this.__mt_swtchActivityIndicator2 = ((MonoTouch.UIKit.UISwitch)(this.GetNativeField("swtchActivityIndicator2")));
return this.__mt_swtchActivityIndicator2;
}
set {
this.__mt_swtchActivityIndicator2 = value;
this.SetNativeField("swtchActivityIndicator2", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">9L30</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.54</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="279384305">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="279384305"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="279384305"/>
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="279384305"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ReachabilityScreen</string>
<string>UIResponder</string>
<string>{{357, 275}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ReachabilityScreen</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">view</string>
<string key="NS.object.0">id</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.0</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Network
{
public partial class ReachabilityScreen : UIViewController
{
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public ReachabilityScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public ReachabilityScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public ReachabilityScreen () : base("ReachabilityScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,33 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Network {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("ReachabilityScreen")]
public partial class ReachabilityScreen {
private MonoTouch.UIKit.UIView __mt_view;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
using System;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.CoreGraphics;
namespace Example_SharedResources.Screens.iPhone.Photos
{
public class CameraOverlayView : UIView
{
#region -= constructors =-
public CameraOverlayView() : base() { Initialize(); }
public CameraOverlayView (RectangleF frame) : base(frame) { Initialize(); }
protected void Initialize()
{
this.BackgroundColor = UIColor.Clear;
}
#endregion
// rect changes depending on if the whole view is being redrawn, or just a section
public override void Draw (RectangleF rect)
{
Console.WriteLine ("Draw() Called");
base.Draw (rect);
// get a reference to the context
using (CGContext context = UIGraphics.GetCurrentContext ()) {
// convert to View space
CGAffineTransform affineTransform = CGAffineTransform.MakeIdentity ();
// invert the y axis
affineTransform.Scale (1, -1);
// move the y axis up
affineTransform.Translate (0, Frame.Height);
context.ConcatCTM (affineTransform);
// draw some stars
DrawStars (context);
}
}
protected void DrawStars (CGContext context)
{
context.SetRGBFillColor (1f, 0f, 0f, 1f);
// save state so that as we translate (move the origin around,
// it goes back to normal when we restore)
context.SetRGBFillColor (0f, 0f, 0.329f, 1.0f);
context.SaveState ();
context.TranslateCTM (30, 300);
DrawStar (context, 30);
context.RestoreState ();
context.SetRGBFillColor (1f, 0f, 0f, 1f);
context.SaveState ();
context.TranslateCTM (120, 200);
DrawStar (context, 30);
context.RestoreState ();
}
/// <summary>
/// Draws a star at the bottom left of the context of the specified diameter
/// </summary>
protected void DrawStar (CGContext context, float starDiameter)
{
// declare vars
// 144º
float theta = 2 * (float)Math.PI * (2f / 5f);
float radius = starDiameter / 2;
// move up and over
context.TranslateCTM (starDiameter / 2, starDiameter / 2);
context.MoveTo (0, radius);
for (int i = 1; i < 5; i++) {
context.AddLineToPoint (radius * (float)Math.Sin (i * theta), radius * (float)Math.Cos (i * theta));
}
//context.SetRGBFillColor (1, 1, 1, 1);
context.ClosePath ();
context.FillPath ();
}
}
}

Просмотреть файл

@ -0,0 +1,278 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">123</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIButton" id="972450759">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {280, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Take Photo</string>
<object class="NSColor" key="IBUIHighlightedTitleColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUIImageView" id="311420832">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 65}, {280, 331}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnTakePhoto</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="972450759"/>
</object>
<int key="connectionID">10</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">imgPhoto</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="311420832"/>
</object>
<int key="connectionID">11</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="972450759"/>
<reference ref="311420832"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="972450759"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="311420832"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>8.IBViewBoundsToFrameTransform</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>CustomCameraViewScreen</string>
<string>UIResponder</string>
<string>{{682, 624}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBoAAAwjAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">11</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">CustomCameraViewScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnTakePhoto</string>
<string>imgPhoto</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnTakePhoto</string>
<string>imgPhoto</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">btnTakePhoto</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">imgPhoto</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">123</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,165 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Photos
{
public partial class CustomCameraViewScreen : UIViewController
{
protected UIImagePickerController imagePicker;
protected PickerDelegate pickerDelegate;
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public CustomCameraViewScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public CustomCameraViewScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public CustomCameraViewScreen () : base("CustomCameraViewScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.Title = "Custom Camera View";
this.btnTakePhoto.TouchUpInside += (object sender, EventArgs e) => {
// create a new picker controller
imagePicker = new UIImagePickerController();
// set our source to the camera
imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
// set
imagePicker.MediaTypes = new string[] { "public.image" };
// show the camera controls
imagePicker.ShowsCameraControls = true;
//UILabel overlay = new UILabel (new System.Drawing.RectangleF (20, 100, 200, 30));
//overlay.Text = "This is an overlay";
//imagePicker.CameraOverlayView = overlay;
//BUGBUG: MT/Apple Bug? - this won't display the overlay, but if i add a label, it'll display
imagePicker.CameraOverlayView = new CameraOverlayView ( UIScreen.MainScreen.ApplicationFrame );
// attach the delegate
pickerDelegate = new PickerDelegate();
imagePicker.Delegate = pickerDelegate;
// show the picker
this.NavigationController.PresentModalViewController (imagePicker, true);
};
}
// Our custom picker delegate. The events haven't been exposed so we have to use a
// delegate.
protected class PickerDelegate : UIImagePickerControllerDelegate
{
public override void Canceled (UIImagePickerController picker)
{
Console.WriteLine ("picker cancelled");
picker.DismissModalViewControllerAnimated (true);
}
public override void FinishedPickingMedia (UIImagePickerController picker, NSDictionary info)
{
// determine what was selected, video or image
bool isImage = false;
switch (info[UIImagePickerController.MediaType].ToString ()) {
case "public.image":
Console.WriteLine ("Image selected");
isImage = true;
break;
Console.WriteLine ("Video selected");
case "public.video":
break;
}
//MT BUGBUG:
Console.Write("Reference URL: [" + UIImagePickerController.ReferenceUrl + "]");
// // get common info (shared between images and video)
// NSUrl referenceURL = info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl;
// if(referenceURL != null)
// {
// //
// Console.WriteLine(referenceURL.ToString());
// }
// if it was an image, get the other image info
if (isImage)
{
// // get the original image
// UIImage originalImage = info[UIImagePickerController.OriginalImage] as UIImage;
// if(originalImage != null)
// {
// // do something with the image
// Console.WriteLine("got the original image");
// }
// // get the edited image
// UIImage editedImage = info[UIImagePickerController.EditedImage] as UIImage;
// if(editedImage != null)
// {
// // do something with the image
// Console.WriteLine("got the edited image");
//
//
// }
// // get the cropping, if any
// try
// {
// RectangleF cropRectangle = (RectangleF)info[UIImagePickerController.CropRect];
// if(cropRectangle != null)
// {
// // do something with the crop rectangle
// Console.WriteLine("Got the crop rectangle");
// }
// } finally {}
// //- get the image metadata
// NSDictionary imageMetadata = info[UIImagePickerController.MediaMetadata] as NSDictionary;
// if(imageMetadata != null)
// {
// // do something with the metadata
// Console.WriteLine("got image metadata");
// }
}
// dismiss the picker
picker.DismissModalViewControllerAnimated (true);
}
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Photos {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("CustomCameraViewScreen")]
public partial class CustomCameraViewScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UIButton __mt_btnTakePhoto;
private MonoTouch.UIKit.UIImageView __mt_imgPhoto;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("btnTakePhoto")]
private MonoTouch.UIKit.UIButton btnTakePhoto {
get {
this.__mt_btnTakePhoto = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnTakePhoto")));
return this.__mt_btnTakePhoto;
}
set {
this.__mt_btnTakePhoto = value;
this.SetNativeField("btnTakePhoto", value);
}
}
[MonoTouch.Foundation.Connect("imgPhoto")]
private MonoTouch.UIKit.UIImageView imgPhoto {
get {
this.__mt_imgPhoto = ((MonoTouch.UIKit.UIImageView)(this.GetNativeField("imgPhoto")));
return this.__mt_imgPhoto;
}
set {
this.__mt_imgPhoto = value;
this.SetNativeField("imgPhoto", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,410 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">123</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="711762367">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIButton" id="277544927">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{12, 10}, {87, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont" id="203528188">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Photo Lib</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="284632581">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="150616170">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUIButton" id="359292509">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{107, 10}, {85, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<reference key="IBUIFont" ref="203528188"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Camera</string>
<reference key="IBUIHighlightedTitleColor" ref="284632581"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="150616170"/>
</object>
<object class="IBUIButton" id="1050810399">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{200, 10}, {108, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<reference key="IBUIFont" ref="203528188"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Photo Roll</string>
<reference key="IBUIHighlightedTitleColor" ref="284632581"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="150616170"/>
</object>
<object class="IBUITableView" id="525024318">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 55}, {320, 361}}</string>
<reference key="NSSuperview" ref="191373211"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">10</int>
<object class="NSImage" key="NSImage">
<int key="NSImageFlags">549453824</int>
<string key="NSSize">{84, 1}</string>
<object class="NSMutableArray" key="NSReps">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="0"/>
<object class="NSBitmapImageRep">
<object class="NSData" key="NSTIFFRepresentation">
<bytes key="NS.bytes">TU0AKgAAAVjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P8ADQEAAAMAAAABAFQAAAEB
AAMAAAABAAEAAAECAAMAAAAEAAAB+gEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES
AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABAAEAAAEXAAQAAAABAAABUAEcAAMAAAABAAEAAAFS
AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
</object>
</object>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
</object>
<string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIAlwaysBounceVertical">YES</bool>
<int key="IBUIStyle">1</int>
<int key="IBUISeparatorStyle">2</int>
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
<float key="IBUIRowHeight">44</float>
<float key="IBUISectionHeaderHeight">10</float>
<float key="IBUISectionFooterHeight">10</float>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<bool key="IBUIPrompted">NO</bool>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">tblFeatures</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="525024318"/>
</object>
<int key="connectionID">11</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnChoosePhoto</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="277544927"/>
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnTakePhoto</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="359292509"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">btnPhotoRoll</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="1050810399"/>
</object>
<int key="connectionID">16</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="525024318"/>
<reference ref="277544927"/>
<reference ref="359292509"/>
<reference ref="1050810399"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="711762367"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="277544927"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="525024318"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="359292509"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="1050810399"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>12.IBViewBoundsToFrameTransform</string>
<string>15.IBPluginDependency</string>
<string>15.IBViewBoundsToFrameTransform</string>
<string>8.IBPluginDependency</string>
<string>8.IBViewBoundsToFrameTransform</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ImagePickerScreen</string>
<string>UIResponder</string>
<string>{{548, 486}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AULWAABBIAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABDSAAAwjQAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBoAAAwjQAAA</bytes>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">16</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ImagePickerScreen</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnChoosePhoto</string>
<string>btnPhotoRoll</string>
<string>btnTakePhoto</string>
<string>tblFeatures</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>btnChoosePhoto</string>
<string>btnPhotoRoll</string>
<string>btnTakePhoto</string>
<string>tblFeatures</string>
<string>view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">btnChoosePhoto</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">btnPhotoRoll</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">btnTakePhoto</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">tblFeatures</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">123</string>
</data>
</archive>

Просмотреть файл

@ -0,0 +1,381 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
namespace Example_SharedResources.Screens.iPhone.Photos
{
public partial class ImagePickerScreen : UIViewController
{
protected UIImagePickerController imagePicker;
protected FeaturesTableDataSource tableSource;
protected PickerDelegate pickerDelegate;
#region Constructors
// The IntPtr and initWithCoder constructors are required for items that need
// to be able to be created from a xib rather than from managed code
public ImagePickerScreen (IntPtr handle) : base(handle)
{
Initialize ();
}
[Export("initWithCoder:")]
public ImagePickerScreen (NSCoder coder) : base(coder)
{
Initialize ();
}
public ImagePickerScreen () : base("ImagePickerScreen", null)
{
Initialize ();
}
void Initialize ()
{
}
#endregion
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Image Picker";
// populate the features table
PopulateFeaturesTable ();
btnChoosePhoto.TouchUpInside += (s, e) => {
// create a new picker controller
imagePicker = new UIImagePickerController ();
// set our source to the photo library
imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
// set what media types
imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.PhotoLibrary);
// As with most controls, you can either handle the events directly, or
// wire up a delegate. in this first one, i wire up the events. in the other two,
// i use a delegate
imagePicker.FinishedPickingMedia += Handle_imagePickerhandleFinishedPickingMedia;
imagePicker.Canceled += (sender,evt) => {
Console.WriteLine ("picker cancelled");
imagePicker.DismissModalViewControllerAnimated(true);
};
// show the picker
NavigationController.PresentModalViewController(imagePicker, true);
};
btnTakePhoto.TouchUpInside += (s, e) => {
// create a new picker controller
imagePicker = new UIImagePickerController ();
// set our source to the camera
imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
// set what media types
imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.Camera);
// show the camera controls
imagePicker.ShowsCameraControls = true;
// attach the delegate
pickerDelegate = new ImagePickerScreen.PickerDelegate ();
imagePicker.Delegate = pickerDelegate;
// show the picker
NavigationController.PresentModalViewController (imagePicker, true);
};
btnPhotoRoll.TouchUpInside += (s, e) => {
// create a new picker controller
imagePicker = new UIImagePickerController ();
// set our source to the camera
imagePicker.SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum;
// set what media types
imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.SavedPhotosAlbum);
// attach the delegate
pickerDelegate = new ImagePickerScreen.PickerDelegate ();
imagePicker.Delegate = pickerDelegate;
// show the picker
NavigationController.PresentModalViewController (imagePicker, true);
};
}
// This is a sample method that handles the FinishedPickingMediaEvent
protected void Handle_imagePickerhandleFinishedPickingMedia (object sender, UIImagePickerMediaPickedEventArgs e)
{
// determine what was selected, video or image
bool isImage = false;
switch(e.Info[UIImagePickerController.MediaType].ToString())
{
case "public.image":
Console.WriteLine("Image selected");
isImage = true;
break;
Console.WriteLine("Video selected");
case "public.video":
break;
}
Console.Write("Reference URL: [" + UIImagePickerController.ReferenceUrl + "]");
// get common info (shared between images and video)
//NSUrl referenceURL = info[UIImagePickerController.ReferenceUrl] as NSUrl;
NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl;
if (referenceURL != null)
Console.WriteLine(referenceURL.ToString ());
// if it was an image, get the other image info
if(isImage) {
// get the original image
UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage;
if(originalImage != null) {
// do something with the image
Console.WriteLine ("got the original image");
}
// get the edited image
UIImage editedImage = e.Info[UIImagePickerController.EditedImage] as UIImage;
if(editedImage != null) {
// do something with the image
Console.WriteLine ("got the edited image");
}
//- get the image metadata
NSDictionary imageMetadata = e.Info[UIImagePickerController.MediaMetadata] as NSDictionary;
if(imageMetadata != null) {
// do something with the metadata
Console.WriteLine ("got image metadata");
}
}
// if it's a video
else {
// get video url
NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl;
if(mediaURL != null) {
//
Console.WriteLine(mediaURL.ToString());
}
}
// dismiss the picker
imagePicker.DismissModalViewControllerAnimated (true);
}
// Fills the table with a list of available features
protected void PopulateFeaturesTable()
{
// declare vars
List<FeatureGroup> features = new List<FeatureGroup> ();
FeatureGroup featGroup;
string[] mediaTypes;
// Sources
featGroup = new FeatureGroup() { Name = "Sources" };
featGroup.Features.Add(new Feature() { Name = "Camera", IsAvailable = UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.Camera) });
featGroup.Features.Add(new Feature() { Name = "Photo Library", IsAvailable = UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.PhotoLibrary) });
featGroup.Features.Add(new Feature() { Name = "Saved Photos Album", IsAvailable = UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.SavedPhotosAlbum) });
features.Add (featGroup);
// Camera and Flash
featGroup = new FeatureGroup() { Name = "Camera and Flash" };
featGroup.Features.Add(new Feature() { Name = "Front Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable (UIImagePickerControllerCameraDevice.Front) });
featGroup.Features.Add(new Feature() { Name = "Front Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice (UIImagePickerControllerCameraDevice.Front) });
featGroup.Features.Add(new Feature() { Name = "Rear Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable (UIImagePickerControllerCameraDevice.Rear) });
featGroup.Features.Add(new Feature() { Name = "Rear Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice (UIImagePickerControllerCameraDevice.Rear) });
features.Add (featGroup);
// Camera Media Types
featGroup = new FeatureGroup() { Name = "Camera Media Types" };
mediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.Camera);
foreach (var mediaType in mediaTypes) {
featGroup.Features.Add (new Feature() { Name = mediaType, IsAvailable = true });
}
features.Add(featGroup);
// Photo Library Media Types
featGroup = new FeatureGroup() { Name = "Photo Library Media Types" };
mediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.PhotoLibrary);
foreach(var mediaType in mediaTypes) {
featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true });
}
features.Add (featGroup);
// Saved Photos Album Media Types
featGroup = new FeatureGroup() { Name = "Saved Photos Album Media Types" };
mediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.SavedPhotosAlbum);
foreach(var mediaType in mediaTypes) {
featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true });
}
features.Add (featGroup);
// bind to the table
tableSource = new ImagePickerScreen.FeaturesTableDataSource (features);
tblFeatures.Source = tableSource;
}
// Our custom picker delegate. The events haven't been exposed so we have to use a
// delegate.
protected class PickerDelegate : UIImagePickerControllerDelegate
{
public override void Canceled (UIImagePickerController picker)
{
Console.WriteLine ("picker cancelled");
picker.DismissModalViewControllerAnimated (true);
}
public override void FinishedPickingMedia (UIImagePickerController picker, NSDictionary info)
{
// determine what was selected, video or image
bool isImage = false;
switch (info[UIImagePickerController.MediaType].ToString()) {
case "public.image":
Console.WriteLine ("Image selected");
isImage = true;
break;
Console.WriteLine ("Video selected");
case "public.video":
break;
}
Console.Write ("Reference URL: [" + UIImagePickerController.ReferenceUrl + "]");
// get common info (shared between images and video)
//NSUrl referenceURL = info[UIImagePickerController.ReferenceUrl] as NSUrl;
NSUrl referenceURL = info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl;
if(referenceURL != null) {
//
Console.WriteLine(referenceURL.ToString ());
}
// if it was an image, get the other image info
if(isImage) {
// get the original image
UIImage originalImage = info[UIImagePickerController.OriginalImage] as UIImage;
if(originalImage != null) {
// do something with the image
Console.WriteLine ("got the original image");
}
// get the edited image
UIImage editedImage = info[UIImagePickerController.EditedImage] as UIImage;
if(editedImage != null) {
// do something with the image
Console.WriteLine ("got the edited image");
}
// // get the cropping, if any
// try
// {
// RectangleF cropRectangle = info[UIImagePickerController.CropRect] as RectangleF;
// if(cropRectangle != null)
// {
// // do something with the crop rectangle
// Console.WriteLine("Got the crop rectangle");
// }
// } finally {}
//- get the image metadata
NSDictionary imageMetadata = info[UIImagePickerController.MediaMetadata] as NSDictionary;
if(imageMetadata != null) {
// do something with the metadata
Console.WriteLine ("got image metadata");
}
}
// if it's a video
else {
// get video url
NSUrl mediaURL = info[UIImagePickerController.MediaURL] as NSUrl;
if(mediaURL != null) {
//
Console.WriteLine(mediaURL.ToString ());
}
}
// dismiss the picker
picker.DismissModalViewControllerAnimated (true);
}
}
#region -= table stuff =-
/// <summary>
/// Group that holds features available
/// </summary>
protected class FeatureGroup
{
public string Name { get; set; }
public List<Feature> Features
{ get { return features; } set { features = value; } }
protected List<Feature> features = new List<Feature>();
}
/// <summary>
/// A feature, such as whether or not the front camera is available
/// </summary>
protected class Feature
{
public string Name { get; set; }
public bool IsAvailable { get; set; }
}
/// <summary>
///
/// </summary>
protected class FeaturesTableDataSource : UITableViewSource
{
protected List<FeatureGroup> features { get; set; }
public FeaturesTableDataSource(List<FeatureGroup> features)
{ this.features = features; }
public override int NumberOfSections (UITableView tableView) { return features.Count; }
public override int RowsInSection (UITableView tableview, int section) { return features[section].Features.Count; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell ("FeatureCell");
if(cell == null)
cell = new UITableViewCell(UITableViewCellStyle.Value1, "FeatureCell");
cell.TextLabel.Text = features[indexPath.Section].Features[indexPath.Row].Name;
cell.DetailTextLabel.Text = features[indexPath.Section].Features[indexPath.Row].IsAvailable.ToString ();
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
return cell;
}
public override string TitleForHeader (UITableView tableView, int section)
{ return features[section].Name; }
public override float GetHeightForRow (UITableView tableView, NSIndexPath indexPath)
{ return 35; }
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,89 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Example_SharedResources.Screens.iPhone.Photos {
// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
[MonoTouch.Foundation.Register("ImagePickerScreen")]
public partial class ImagePickerScreen {
private MonoTouch.UIKit.UIView __mt_view;
private MonoTouch.UIKit.UITableView __mt_tblFeatures;
private MonoTouch.UIKit.UIButton __mt_btnChoosePhoto;
private MonoTouch.UIKit.UIButton __mt_btnTakePhoto;
private MonoTouch.UIKit.UIButton __mt_btnPhotoRoll;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
this.__mt_view = ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
return this.__mt_view;
}
set {
this.__mt_view = value;
this.SetNativeField("view", value);
}
}
[MonoTouch.Foundation.Connect("tblFeatures")]
private MonoTouch.UIKit.UITableView tblFeatures {
get {
this.__mt_tblFeatures = ((MonoTouch.UIKit.UITableView)(this.GetNativeField("tblFeatures")));
return this.__mt_tblFeatures;
}
set {
this.__mt_tblFeatures = value;
this.SetNativeField("tblFeatures", value);
}
}
[MonoTouch.Foundation.Connect("btnChoosePhoto")]
private MonoTouch.UIKit.UIButton btnChoosePhoto {
get {
this.__mt_btnChoosePhoto = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnChoosePhoto")));
return this.__mt_btnChoosePhoto;
}
set {
this.__mt_btnChoosePhoto = value;
this.SetNativeField("btnChoosePhoto", value);
}
}
[MonoTouch.Foundation.Connect("btnTakePhoto")]
private MonoTouch.UIKit.UIButton btnTakePhoto {
get {
this.__mt_btnTakePhoto = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnTakePhoto")));
return this.__mt_btnTakePhoto;
}
set {
this.__mt_btnTakePhoto = value;
this.SetNativeField("btnTakePhoto", value);
}
}
[MonoTouch.Foundation.Connect("btnPhotoRoll")]
private MonoTouch.UIKit.UIButton btnPhotoRoll {
get {
this.__mt_btnPhotoRoll = ((MonoTouch.UIKit.UIButton)(this.GetNativeField("btnPhotoRoll")));
return this.__mt_btnPhotoRoll;
}
set {
this.__mt_btnPhotoRoll = value;
this.SetNativeField("btnPhotoRoll", value);
}
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
using System;
using MonoTouch.UIKit;
namespace Example_SharedResources.Screens.iPhone.Photos
{
public class TestCameraOverlayController : UIViewController
{
#region -= constructors =-
public TestCameraOverlayController () : base()
{
}
#endregion
public override void LoadView ()
{
this.View = new CameraOverlayView ();
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
//---- set the background color of the view to clear
this.View.BackgroundColor = UIColor.Clear;
}
}
}

Просмотреть файл

@ -0,0 +1,198 @@
<?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>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7624AE01-3981-42DC-AA85-9D88A2CF6840}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Example_SharedResources</RootNamespace>
<AssemblyName>Example_SharedResources</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>true</MtouchDebug>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchI18n />
<MtouchUseArmv7>false</MtouchUseArmv7>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchI18n />
<MtouchUseArmv7>false</MtouchUseArmv7>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>true</MtouchDebug>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchI18n />
<MtouchUseArmv7>false</MtouchUseArmv7>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchI18n />
<MtouchUseArmv7>false</MtouchUseArmv7>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Code\" />
<Folder Include="Controls\" />
<Folder Include="Images\" />
<Folder Include="Images\Icons\" />
<Folder Include="Screens\" />
<Folder Include="Screens\iPhone\" />
<Folder Include="Screens\iPhone\Home\" />
<Folder Include="Screens\iPhone\Network\" />
<Folder Include="Screens\iPhone\Battery\" />
<Folder Include="Code\Network\" />
<Folder Include="Screens\iPhone\Contacts\" />
<Folder Include="Screens\iPhone\Photos\" />
<Folder Include="Screens\iPhone\Accelerometer\" />
<Folder Include="Screens\iPhone\FileSystem\" />
<Folder Include="Screens\iPhone\AVAssets\" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppDelegate.cs" />
<Compile Include="Application.cs" />
<Compile Include="Code\NavItem.cs" />
<Compile Include="Code\NavItemGroup.cs" />
<Compile Include="Code\NavItemTableSource.cs" />
<Compile Include="Screens\iPhone\Home\HomeTableViewController.cs" />
<Compile Include="Screens\iPhone\Network\ActivityIndicatorScreen.xib.cs">
<DependentUpon>ActivityIndicatorScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Network\ActivityIndicatorScreen.xib.designer.cs">
<DependentUpon>ActivityIndicatorScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Battery\BatteryStatusScreen.xib.cs">
<DependentUpon>BatteryStatusScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Battery\BatteryStatusScreen.xib.designer.cs">
<DependentUpon>BatteryStatusScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Network\ReachabilityScreen.xib.cs">
<DependentUpon>ReachabilityScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Network\ReachabilityScreen.xib.designer.cs">
<DependentUpon>ReachabilityScreen.xib</DependentUpon>
</Compile>
<Compile Include="Code\Network\NetworkStatus.cs" />
<Compile Include="Code\Network\Reachability.cs" />
<Compile Include="Screens\iPhone\Contacts\ContactPickerScreen.xib.cs">
<DependentUpon>ContactPickerScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Contacts\ContactPickerScreen.xib.designer.cs">
<DependentUpon>ContactPickerScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Contacts\AddressBookScreen.xib.cs">
<DependentUpon>AddressBookScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Contacts\AddressBookScreen.xib.designer.cs">
<DependentUpon>AddressBookScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Contacts\NewAndUnknownContactScreen.xib.cs">
<DependentUpon>NewAndUnknownContactScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Contacts\NewAndUnknownContactScreen.xib.designer.cs">
<DependentUpon>NewAndUnknownContactScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Photos\ImagePickerScreen.xib.cs">
<DependentUpon>ImagePickerScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Photos\ImagePickerScreen.xib.designer.cs">
<DependentUpon>ImagePickerScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Accelerometer\XYZDataScreen.xib.cs">
<DependentUpon>XYZDataScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Accelerometer\XYZDataScreen.xib.designer.cs">
<DependentUpon>XYZDataScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Accelerometer\ShakeScreen.xib.cs">
<DependentUpon>ShakeScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Accelerometer\ShakeScreen.xib.designer.cs">
<DependentUpon>ShakeScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\FileSystem\FileSystemInfo.xib.cs">
<DependentUpon>FileSystemInfo.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\FileSystem\FileSystemInfo.xib.designer.cs">
<DependentUpon>FileSystemInfo.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Photos\CustomCameraViewScreen.xib.cs">
<DependentUpon>CustomCameraViewScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Photos\CustomCameraViewScreen.xib.designer.cs">
<DependentUpon>CustomCameraViewScreen.xib</DependentUpon>
</Compile>
<Compile Include="Screens\iPhone\Photos\CameraOverlayView.cs" />
<Compile Include="Screens\iPhone\Photos\TestCameraOverlayController.cs" />
<Compile Include="Screens\iPhone\AVAssets\PhotoLibraryController.cs" />
<Compile Include="Screens\iPhone\AVAssets\AssetEnumerationScreen.cs" />
<Compile Include="Screens\iPhone\AVAssets\AssetGroupEnumerationScreen.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Screens\iPhone\Network\ActivityIndicatorScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Battery\BatteryStatusScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Network\ReachabilityScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Contacts\ContactPickerScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Contacts\AddressBookScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Contacts\NewAndUnknownContactScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Photos\ImagePickerScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Accelerometer\XYZDataScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Accelerometer\ShakeScreen.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\FileSystem\FileSystemInfo.xib" xmlns="" />
<InterfaceDefinition Include="Screens\iPhone\Photos\CustomCameraViewScreen.xib" xmlns="" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Content Include="Images\Icons\29_icon.png" />
<Content Include="Images\Icons\50_icon.png" />
<Content Include="Images\Icons\57_icon.png" />
<Content Include="Images\Icons\58_icon.png" />
<Content Include="Images\Icons\72_icon.png" />
<Content Include="Images\Icons\114_icon.png" />
<Content Include="Images\Icons\512_icon.png" />
<Content Include="Default-Landscape~ipad.png" />
<Content Include="Default-Portrait~ipad.png" />
<Content Include="Default.png" />
<Content Include="Default%402x.png" />
</ItemGroup>
</Project>