Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[TaksyL10nStoryboard] how to localize storyboard sample

Requires iOS6
  • Loading branch information...
commit c18fac7bbb88b39343c8079c3aeaab021dbdff84 1 parent 0d764b7
@conceptdev authored
View
50 TaskyL10nStoryboard/AppDelegate.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace StoryboardTables
+{
+ // The UIApplicationDelegate for the application. This class is responsible for launching the
+ // User Interface of the application, as well as listening (and optionally responding) to
+ // application events from iOS.
+ [Register ("AppDelegate")]
+ public partial class AppDelegate : UIApplicationDelegate
+ {
+ // class-level declarations
+
+ public override UIWindow Window {
+ get;
+ set;
+ }
+
+ //
+ // This method is invoked when the application is about to move from active to inactive state.
+ //
+ // OpenGL applications should use this method to pause.
+ //
+ public override void OnResignActivation (UIApplication application)
+ {
+ }
+
+ // This method should be used to release shared resources and it should store the application state.
+ // If your application supports background exection this method is called instead of WillTerminate
+ // when the user quits.
+ public override void DidEnterBackground (UIApplication application)
+ {
+ }
+
+ // This method is called as part of the transiton from background to active state.
+ public override void WillEnterForeground (UIApplication application)
+ {
+ }
+
+ // This method is called when the application is about to terminate. Save data, if needed.
+ public override void WillTerminate (UIApplication application)
+ {
+ }
+ }
+}
+
View
237 TaskyL10nStoryboard/Base.lproj/MainStoryboard.storyboard
@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2840" systemVersion="12C3104" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="3">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1926"/>
+ </dependencies>
+ <scenes>
+ <!--Navigation Controller-->
+ <scene sceneID="11">
+ <objects>
+ <navigationController id="3" sceneMemberID="viewController">
+ <navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="4">
+ <autoresizingMask key="autoresizingMask"/>
+ </navigationBar>
+ <connections>
+ <segue destination="12" kind="relationship" relationship="rootViewController" id="19"/>
+ </connections>
+ </navigationController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="10" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-1" y="64"/>
+ </scene>
+ <!--Root View Controller - Master-->
+ <scene sceneID="18">
+ <objects>
+ <tableViewController storyboardIdentifier="master" title="Master" id="12" customClass="RootViewController" sceneMemberID="viewController">
+ <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="13">
+ <rect key="frame" x="0.0" y="64" width="320" height="416"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <prototypes>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="taskcell" id="30">
+ <rect key="frame" x="0.0" y="22" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Detail" lineBreakMode="tailTruncation" minimumFontSize="10" id="34">
+ <rect key="frame" x="10" y="10" width="300" height="24"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ <connections>
+ <segue destination="LmH-xe-dDP" kind="push" identifier="TaskSegue" id="Mef-pQ-QFW"/>
+ </connections>
+ </tableViewCell>
+ </prototypes>
+ <sections/>
+ <connections>
+ <outlet property="dataSource" destination="12" id="16"/>
+ <outlet property="delegate" destination="12" id="15"/>
+ </connections>
+ </tableView>
+ <navigationItem key="navigationItem" title="TaskyBoard" id="35">
+ <barButtonItem key="rightBarButtonItem" systemItem="add" id="Kez-Wg-Sfp"/>
+ </navigationItem>
+ <connections>
+ <outlet property="AddButton" destination="Kez-Wg-Sfp" id="vUV-Xm-kaT"/>
+ </connections>
+ </tableViewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="17" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="455" y="64"/>
+ </scene>
+ <!--Task Detail View Controller - Task Detail-->
+ <scene sceneID="5ee-Jh-g1s">
+ <objects>
+ <tableViewController storyboardIdentifier="detail" title="Task Detail" id="LmH-xe-dDP" customClass="TaskDetailViewController" sceneMemberID="viewController">
+ <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="none" allowsSelection="NO" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="jTP-LC-W9u">
+ <rect key="frame" x="0.0" y="64" width="320" height="416"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
+ <color key="separatorColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <sections>
+ <tableViewSection id="kFR-hb-f2z">
+ <cells>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="title" id="lI0-If-rIm">
+ <rect key="frame" x="0.0" y="10" width="320" height="45"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="10" y="1" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="zwR-D9-hM1">
+ <rect key="frame" x="20" y="11" width="42" height="19"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </label>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="SXg-TT-IwM">
+ <rect key="frame" x="70" y="6" width="225" height="31"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="notes" id="rki-Ec-knm">
+ <rect key="frame" x="0.0" y="55" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="10" y="0.0" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="Pqa-aa-ury">
+ <rect key="frame" x="70" y="6" width="224" height="31"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Notes" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="bAM-2j-Rzw">
+ <rect key="frame" x="19" y="11" width="46" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="done" id="Bq3-hy-Og5">
+ <rect key="frame" x="0.0" y="99" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="10" y="0.0" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <switch opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="meq-FH-E52">
+ <rect key="frame" x="215" y="8" width="79" height="27"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </switch>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Done" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="NF3-h8-xmR">
+ <rect key="frame" x="20" y="8" width="42" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ </cells>
+ </tableViewSection>
+ <tableViewSection id="Xfc-aN-IAQ">
+ <cells>
+ <tableViewCell alpha="0.0" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="save" rowHeight="83" id="3V1-0U-B53">
+ <rect key="frame" x="0.0" y="163" width="320" height="84"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="10" y="1" width="300" height="82"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="MWt-Ya-pMf">
+ <rect key="frame" x="0.0" y="0.0" width="300" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+ <state key="normal" title="Save">
+ <color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted">
+ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ </button>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="IGr-pR-05L">
+ <rect key="frame" x="0.0" y="45" width="300" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+ <state key="normal" title="Delete">
+ <color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted">
+ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ </button>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </tableViewCell>
+ </cells>
+ </tableViewSection>
+ </sections>
+ <connections>
+ <outlet property="dataSource" destination="LmH-xe-dDP" id="sql-X3-54b"/>
+ <outlet property="delegate" destination="LmH-xe-dDP" id="scx-1g-0iu"/>
+ </connections>
+ </tableView>
+ <navigationItem key="navigationItem" id="My4-ws-Xah"/>
+ <connections>
+ <outlet property="DeleteButton" destination="IGr-pR-05L" id="8Em-Ll-65j"/>
+ <outlet property="DoneSwitch" destination="meq-FH-E52" id="h46-k8-wXx"/>
+ <outlet property="NotesText" destination="Pqa-aa-ury" id="n8F-DU-ZeS"/>
+ <outlet property="SaveButton" destination="MWt-Ya-pMf" id="XKe-Rj-bI0"/>
+ <outlet property="TitleText" destination="SXg-TT-IwM" id="hJC-to-cJV"/>
+ </connections>
+ </tableViewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="ERw-Tm-SoF" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="919" y="64"/>
+ </scene>
+ </scenes>
+ <classes>
+ <class className="RootViewController" superclassName="UITableViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/RootViewController.h"/>
+ <relationships>
+ <relationship kind="outlet" name="AddButton" candidateClass="UIBarButtonItem"/>
+ </relationships>
+ </class>
+ <class className="TaskDetailViewController" superclassName="UITableViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/TaskDetailViewController.h"/>
+ <relationships>
+ <relationship kind="outlet" name="DeleteButton" candidateClass="UIButton"/>
+ <relationship kind="outlet" name="DoneSwitch" candidateClass="UISwitch"/>
+ <relationship kind="outlet" name="NotesText" candidateClass="UITextField"/>
+ <relationship kind="outlet" name="SaveButton" candidateClass="UIButton"/>
+ <relationship kind="outlet" name="TitleText" candidateClass="UITextField"/>
+ </relationships>
+ </class>
+ </classes>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination"/>
+ </simulatedMetricsContainer>
+</document>
View
22 TaskyL10nStoryboard/Info.plist
@@ -0,0 +1,22 @@
+<?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>TaskyL10n</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.xamarin.samples.taskyl10nstoryboard</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>UIDeviceFamily</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>UIMainStoryboardFile</key>
+ <string>MainStoryboard</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+</dict>
+</plist>
View
20 TaskyL10nStoryboard/Main.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace StoryboardTables
+{
+ public class Application
+ {
+ // This is the main entry point of the application.
+ static void Main (string[] args)
+ {
+ // if you want to use a different Application Delegate class from "AppDelegate"
+ // you can specify it here.
+ UIApplication.Main (args, null, "AppDelegate");
+ }
+ }
+}
View
3  TaskyL10nStoryboard/Resources/en.lproj/Localizable.strings
@@ -0,0 +1,3 @@
+"<new task>" = "<new task>";
+"task name" = "task name";
+"other task info"= "other task info";
View
9 TaskyL10nStoryboard/Resources/en.lproj/MainStoryboard.strings
@@ -0,0 +1,9 @@
+
+"SXg-TT-IwM.placeholder" = "task name";
+"Pqa-aa-ury.placeholder"= "other task info";
+
+"zwR-D9-hM1.text" = "Task Details";
+"bAM-2j-Rzw.text" = "Notes";
+"NF3-h8-xmR.text" = "Done";
+"MWt-Ya-pMf.normalTitle" = "Save";
+"IGr-pR-05L.normalTitle" = "Delete";
View
3  TaskyL10nStoryboard/Resources/es.lproj/Localizable.strings
@@ -0,0 +1,3 @@
+"<new task>" = "<new task>";
+"task name" = "nombre de la tarea";
+"other task info"= "otra información de tarea";
View
10 TaskyL10nStoryboard/Resources/es.lproj/MainStoryboard.strings
@@ -0,0 +1,10 @@
+/* MACHINE TRANSLATION : apologies for any mistakes */
+
+"SXg-TT-IwM.placeholder" = "nombre de la tarea";
+"Pqa-aa-ury.placeholder"= "otra información de tarea";
+
+"zwR-D9-hM1.text" = "Detalles de la tarea";
+"bAM-2j-Rzw.text" = "Notas";
+"NF3-h8-xmR.text" = "Completo";
+"MWt-Ya-pMf.normalTitle" = "Guardar";
+"IGr-pR-05L.normalTitle" = "Eliminar";
View
3  TaskyL10nStoryboard/Resources/ja.lproj/Localizable.strings
@@ -0,0 +1,3 @@
+"<new task>" = "<新しいタスク>";
+"task name" = "タスク名";
+"other task info"= "他のタスクの情報";
View
10 TaskyL10nStoryboard/Resources/ja.lproj/MainStoryboard.strings
@@ -0,0 +1,10 @@
+/* MACHINE TRANSLATION : apologies for any mistakes */
+
+"SXg-TT-IwM.placeholder" = "タスク名";
+"Pqa-aa-ury.placeholder"= "他のタスクの情報";
+
+"zwR-D9-hM1.text" = "タスクの詳細";
+"bAM-2j-Rzw.text" = "注釈";
+"NF3-h8-xmR.text" = "削除する";
+"MWt-Ya-pMf.normalTitle" = "はい";
+"IGr-pR-05L.normalTitle" = "削除する";
View
43 TaskyL10nStoryboard/RootTableSource.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace StoryboardTables {
+ public class RootTableSource : UITableViewSource {
+ // ##
+ // there is NO database or storage of Tasks in this example, just an in-memory List<>
+ // refer to the other Tasky samples on github for an implementation using SQLite-NET
+ // ##
+ Task[] tableItems;
+ string cellIdentifier = "taskcell";
+
+ public RootTableSource (Task[] items)
+ {
+ tableItems = items;
+ }
+
+ public override int RowsInSection (UITableView tableview, int section)
+ {
+ return tableItems.Length;
+ }
+ public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
+ {
+ // in a Storyboard, Dequeue will ALWAYS return a cell,
+ UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
+ cell.TextLabel.Text = tableItems[indexPath.Row].Name;
+
+ if (tableItems[indexPath.Row].Done)
+ cell.Accessory = UITableViewCellAccessory.Checkmark;
+ else
+ cell.Accessory = UITableViewCellAccessory.None;
+
+ return cell;
+ }
+
+ public Task GetItem(int id) {
+ return tableItems[id];
+ }
+ }
+}
View
142 TaskyL10nStoryboard/RootViewController.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Drawing;
+using System.Collections.Generic;
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace StoryboardTables
+{
+ public partial class RootViewController : UITableViewController
+ {
+ // The list of tasks is NOT persisted, even though you can add and delete tasks
+ // in this sample, the changes are only in memory and will disappear when the app restarts
+ List<Task> tasks;
+
+ public RootViewController (IntPtr handle) : base (handle)
+ {
+ Title = "TaskBoard";
+
+ // Custom initialization
+ tasks = new List<Task> {
+ new Task() {Name="Groceries", Notes="Buy bread, cheese, apples", Done=false},
+ new Task() {Name="Devices", Notes="Buy Nexus, Galaxy, Droid", Done=false}
+ };
+ }
+
+ /// <summary>
+ /// Prepares for segue.
+ /// </summary>
+ /// <remarks>
+ /// The prepareForSegue method is invoked whenever a segue is about to take place.
+ /// The new view controller has been loaded from the storyboard at this point but
+ /// it’s not visible yet, and we can use this opportunity to send data to it.
+ /// </remarks>
+ public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
+ {
+ if (segue.Identifier == "TaskSegue") { // set in Storyboard
+ var navctlr = segue.DestinationViewController as TaskDetailViewController;
+ if (navctlr != null) {
+ var source = TableView.Source as RootTableSource;
+ var rowPath = TableView.IndexPathForSelectedRow;
+ var item = source.GetItem(rowPath.Row);
+ navctlr.SetTask(this, item);
+ }
+ }
+ }
+
+ public void CreateTask () {
+ // first, add the task to the underlying data
+ var newId = tasks[tasks.Count - 1].Id + 1;
+ var newTask = new Task(){Id=newId};
+ tasks.Add (newTask);
+ // then open the detail view to edit it
+ var detail = Storyboard.InstantiateViewController("detail") as TaskDetailViewController;
+ detail.SetTask (this, newTask);
+ NavigationController.PushViewController (detail, true);
+
+ // Could to this instead of the above, but need to create 'new Task()' in PrepareForSegue()
+ //this.PerformSegue ("TaskSegue", this);
+ }
+ public void SaveTask (Task task) {
+ Console.WriteLine("Save "+task.Name);
+ var oldTask = tasks.Find(t => t.Id == task.Id);
+ oldTask = task;
+ NavigationController.PopViewControllerAnimated(true);
+ }
+ public void DeleteTask (Task task) {
+ Console.WriteLine("Delete "+task.Name);
+ var oldTask = tasks.Find(t => t.Id == task.Id);
+ tasks.Remove (oldTask);
+ NavigationController.PopViewControllerAnimated(true);
+ }
+
+
+
+
+
+
+ public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
+ {
+ // Return true for supported orientations
+ return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
+ }
+
+ public override void DidReceiveMemoryWarning ()
+ {
+ // Releases the view if it doesn't have a superview.
+ base.DidReceiveMemoryWarning ();
+
+ // Release any cached data, images, etc that aren't in use.
+ }
+
+ #region View lifecycle
+
+ public override void ViewDidLoad ()
+ {
+ base.ViewDidLoad ();
+
+ // Perform any additional setup after loading the view, typically from a nib.
+ AddButton.Clicked += (sender, e) => {
+ CreateTask ();
+ };
+ }
+
+ public override void ViewDidUnload ()
+ {
+ base.ViewDidUnload ();
+
+ // Clear any references to subviews of the main view in order to
+ // allow the Garbage Collector to collect them sooner.
+ //
+ // e.g. myOutlet.Dispose (); myOutlet = null;
+
+// ReleaseDesignerOutlets ();
+ }
+
+ public override void ViewWillAppear (bool animated)
+ {
+ base.ViewWillAppear (animated);
+
+ // bind every time, to reflect deletion in the Detail view
+ TableView.Source = new RootTableSource(tasks.ToArray ());
+ }
+
+ public override void ViewDidAppear (bool animated)
+ {
+ base.ViewDidAppear (animated);
+ }
+
+ public override void ViewWillDisappear (bool animated)
+ {
+ base.ViewWillDisappear (animated);
+ }
+
+ public override void ViewDidDisappear (bool animated)
+ {
+ base.ViewDidDisappear (animated);
+ }
+
+ #endregion
+ }
+}
+
View
17 TaskyL10nStoryboard/RootViewController.designer.cs
@@ -0,0 +1,17 @@
+// WARNING
+//
+// This file has been generated automatically by MonoDevelop to store outlets and
+// actions made in the Xcode designer. If it is removed, they will be lost.
+// Manual changes to this file may not be handled correctly.
+//
+using MonoTouch.Foundation;
+
+namespace StoryboardTables
+{
+ [Register ("RootViewController")]
+ partial class RootViewController
+ {
+ [Outlet]
+ MonoTouch.UIKit.UIBarButtonItem AddButton { get; set; }
+ }
+}
View
17 TaskyL10nStoryboard/Task.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace StoryboardTables {
+ /// <summary>
+ /// Represents a Task.
+ /// </summary>
+ public class Task {
+ public Task ()
+ {
+ }
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public string Notes { get; set; }
+ public bool Done { get; set; }
+ }
+}
+
View
47 TaskyL10nStoryboard/TaskDetailViewController.cs
@@ -0,0 +1,47 @@
+// This file has been autogenerated from parsing an Objective-C header file added in Xcode.
+
+using System;
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace StoryboardTables
+{
+ public partial class TaskDetailViewController : UITableViewController
+ {
+ Task currentTask {get;set;}
+ public RootViewController Delegate {get;set;}
+
+ public TaskDetailViewController (IntPtr handle) : base (handle)
+ {
+
+ }
+
+ public override void ViewDidLoad ()
+ {
+ base.ViewDidLoad ();
+ SaveButton.TouchUpInside += (sender, e) => {
+ currentTask.Name = TitleText.Text;
+ currentTask.Notes = NotesText.Text;
+ currentTask.Done = DoneSwitch.On;
+ Delegate.SaveTask(currentTask);
+ };
+ DeleteButton.TouchUpInside += (sender, e) => {
+ Delegate.DeleteTask(currentTask);
+ };
+ }
+
+ // this will be called before the view is displayed
+ public void SetTask (RootViewController d, Task task) {
+ Delegate = d;
+ currentTask = task;
+ }
+ // when displaying, set-up the properties
+ public override void ViewWillAppear (bool animated)
+ {
+ base.ViewWillAppear (animated);
+ TitleText.Text = currentTask.Name;
+ NotesText.Text = currentTask.Notes;
+ DoneSwitch.On = currentTask.Done;
+ }
+ }
+}
View
29 TaskyL10nStoryboard/TaskDetailViewController.designer.cs
@@ -0,0 +1,29 @@
+// WARNING
+//
+// This file has been generated automatically by MonoDevelop to store outlets and
+// actions made in the Xcode designer. If it is removed, they will be lost.
+// Manual changes to this file may not be handled correctly.
+//
+using MonoTouch.Foundation;
+
+namespace StoryboardTables
+{
+ [Register ("TaskDetailViewController")]
+ partial class TaskDetailViewController
+ {
+ [Outlet]
+ MonoTouch.UIKit.UITextField TitleText { get; set; }
+
+ [Outlet]
+ MonoTouch.UIKit.UITextField NotesText { get; set; }
+
+ [Outlet]
+ MonoTouch.UIKit.UISwitch DoneSwitch { get; set; }
+
+ [Outlet]
+ MonoTouch.UIKit.UIButton DeleteButton { get; set; }
+
+ [Outlet]
+ MonoTouch.UIKit.UIButton SaveButton { get; set; }
+ }
+}
View
103 TaskyL10nStoryboard/TaskyL10nStoryboard.csproj
@@ -0,0 +1,103 @@
+<?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>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{08A1E777-C427-42A1-9DB4-F7C9105E389B}</ProjectGuid>
+ <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>StoryboardTables</RootNamespace>
+ </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>
+ <ConsolePause>False</ConsolePause>
+ <MtouchDebug>True</MtouchDebug>
+ <MtouchProfiling>True</MtouchProfiling>
+ <MtouchLink>None</MtouchLink>
+ <AssemblyName>L10nStoryboard</AssemblyName>
+ <MtouchI18n />
+ <MtouchArch>ARMv7</MtouchArch>
+ </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>
+ <AssemblyName>L10nStoryboard</AssemblyName>
+ </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>
+ <ConsolePause>False</ConsolePause>
+ <CodesignKey>iPhone Developer</CodesignKey>
+ <MtouchDebug>True</MtouchDebug>
+ <MtouchProfiling>True</MtouchProfiling>
+ <AssemblyName>StoryboardTables</AssemblyName>
+ <IpaPackageName />
+ </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>
+ <AssemblyName>StoryboardTables</AssemblyName>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="monotouch" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Info.plist" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="AppDelegate.cs" />
+ <Compile Include="RootViewController.cs" />
+ <Compile Include="RootViewController.designer.cs">
+ <DependentUpon>RootViewController.cs</DependentUpon>
+ </Compile>
+ <Compile Include="TaskDetailViewController.cs" />
+ <Compile Include="TaskDetailViewController.designer.cs">
+ <DependentUpon>TaskDetailViewController.cs</DependentUpon>
+ </Compile>
+ <Compile Include="RootTableSource.cs" />
+ <Compile Include="Task.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <InterfaceDefinition Include="Base.lproj\MainStoryboard.storyboard" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <Folder Include="Base.lproj\" />
+ <Folder Include="Resources\" />
+ </ItemGroup>
+ <ItemGroup>
+ <BundleResource Include="Resources\en.lproj\Localizable.strings" />
+ <BundleResource Include="Resources\en.lproj\MainStoryboard.strings" />
+ <BundleResource Include="Resources\es.lproj\Localizable.strings" />
+ <BundleResource Include="Resources\es.lproj\MainStoryboard.strings" />
+ <BundleResource Include="Resources\ja.lproj\Localizable.strings" />
+ <BundleResource Include="Resources\ja.lproj\MainStoryboard.strings" />
+ </ItemGroup>
+</Project>
View
26 TaskyL10nStoryboard/TaskyL10nStoryboard.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskyL10nStoryboard", "TaskyL10nStoryboard.csproj", "{08A1E777-C427-42A1-9DB4-F7C9105E389B}"
+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
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhone.ActiveCfg = Debug|iPhone
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhone.Build.0 = Debug|iPhone
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhone.ActiveCfg = Release|iPhone
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhone.Build.0 = Release|iPhone
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = TaskyL10nStoryboard.csproj
+ EndGlobalSection
+EndGlobal
Please sign in to comment.
Something went wrong with that request. Please try again.