Added Quotes and RegionDefiner samples

This commit is contained in:
PJ Beaman 2012-09-19 14:41:34 -04:00
Родитель 406784cde9
Коммит bfc0a21dd9
50 изменённых файлов: 2440 добавлений и 0 удалений

32
Quotes/AppDelegate.cs Normal file
Просмотреть файл

@ -0,0 +1,32 @@
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Quotes
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
UINavigationController viewController = new UINavigationController ();
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.RootViewController = viewController;
window.MakeKeyAndVisible ();
// Create and push our master view controller
var allTheQuotes = new MasterViewController (null, NSBundle.MainBundle);
viewController.PushViewController (allTheQuotes, false);
return true;
}
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
}

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

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

После

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

Двоичные данные
Quotes/Images/100_icon.png Executable file

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

После

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

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

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

После

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

Двоичные данные
Quotes/Images/144_icon.png Executable file

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

После

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

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

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

После

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

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

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

После

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

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

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

После

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

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

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

После

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

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

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

После

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

36
Quotes/Info.plist Normal file
Просмотреть файл

@ -0,0 +1,36 @@
<?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>CFBundleIconFiles</key>
<array>
<string>Images/57_icon.png</string>
<string>Images/114_icon.png</string>
<string>Images/72_icon.png</string>
<string>Images/144_icon.png</string>
<string>Images/29_icon.png</string>
<string>Images/58_icon.png</string>
<string>Images/50_icon.png</string>
<string>Images/100_icon.png</string>
</array>
<key>MinimumOSVersion</key>
<string>5.2</string>
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array/>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>CFBundleDisplayName</key>
<string>Quotes</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.quotes</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>

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

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using System.Text.RegularExpressions;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Quotes
{
public class MasterViewController : UICollectionViewController
{
List<Page> pages;
string[] titles = new string [5];
NSString cellName = new NSString ("PagePreview");
[Export ("initWithNibName:")]
public MasterViewController (string nibNameOrNull, NSBundle nibBundleOrNull) : base (nibNameOrNull, nibBundleOrNull)
{
titles [0] = "Faust - Erste Szene";
titles [1] = "Julius Caesar - Antony's speech";
titles [2] = "Midsummer Night's Dream - Exit speech";
titles [3] = "Romeo & Juliet - Queen Mab";
titles [4] = "Troilus and Cressida - Ulysses";
LoadPagesFromResource ("/Pages");
}
// Walk through all pages in the supplied folder in our resources and load the files we find.
public void LoadPagesFromResource (string pageDirectory)
{
pages = new List<Page> ();
int count = 0;
foreach (var p in Directory.GetFiles (NSBundle.MainBundle.BundlePath + pageDirectory, "*.xml")) {
var title = titles [count];
count++;
var xdoc = XDocument.Load (p);
var paragraphs = new List<XElement> (xdoc.Root.Elements ());
pages.Add (new Page (title, paragraphs));
}
Title = "Pages";
}
/* Create a collection view with a flow layout. Set up the cell, and assign it to
* our base CollectionView property.
*/
public override void LoadView ()
{
var layout = new UICollectionViewFlowLayout ();
layout.MinimumInteritemSpacing = 20;
layout.ItemSize = new SizeF (200.0f, 290.0f);
var collectionView = new UICollectionView (UIScreen.MainScreen.ApplicationFrame, layout);
collectionView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
collectionView.BackgroundColor = UIColor.White;
var nib = UINib.FromName (cellName, null);
collectionView.RegisterNibForCell (nib, cellName);
CollectionView = collectionView;
}
public override int GetItemsCount (UICollectionView collectionView, int section)
{
return pages.Count;
}
public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = (PagePreview)collectionView.DequeueReusableCell (cellName, indexPath);
cell.Page = pages.ElementAt (indexPath.Row);
return cell;
}
public override void ItemSelected (UICollectionView collectionView, NSIndexPath indexPath)
{
var pvc = new PageViewController ();
pvc.controllerPage = pages.ElementAt (indexPath.Row);
NavigationController.PushViewController (pvc, true);
}
}
}

107
Quotes/Page.cs Normal file
Просмотреть файл

@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Xml.XPath;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreText;
namespace Quotes
{
public class Page : NSObject
{
// The paragraphs loaded from the XML file
public List<XElement> Paragraphs { get; set; }
public string Title { get; set; }
public int SelectedParagraph { get; set; }
public float LineHeight { get; set; }
public Page (string title, List<XElement> paragraphs)
{
Title = title;
Paragraphs = paragraphs;
SelectedParagraph = NSRange.NotFound;
LineHeight = 25.0f;
}
public string SpeakerForParagraph (XElement paragraph)
{
var next = paragraph.XPathSelectElement ("key[text()='speaker']").NextNode as XElement;
return next.Value;
}
public string TextForParagraph (XElement paragraph)
{
var next = paragraph.XPathSelectElement ("key[text()='text']").NextNode as XElement;
return next.Value;
}
public bool ParagraphIsStageDirection (XElement paragraph)
{
var next = paragraph.XPathSelectElement ("key[text()='speaker']").NextNode as XElement;
var body = next.Value;
return body == "STAGE DIRECTION";
}
public NSAttributedString AttributedStringForParagraph (XElement paragraph)
{
var returnValue = new NSMutableAttributedString ();
// TODO: find stage directions and format them differently
if (ParagraphIsStageDirection (paragraph)) {
var stageDirection = new NSAttributedString (TextForParagraph (paragraph),
font: UIFont.FromName ("Helvetica-LightOblique", 24),
paragraphStyle: new NSMutableParagraphStyle () { Alignment = UITextAlignment.Center, LineSpacing = 10});
returnValue.Append (stageDirection);
} else {
var speaker = new NSAttributedString (SpeakerForParagraph (paragraph),
font: UIFont.FromName ("HoeflerText-Black", 24),
foregroundColor: UIColor.Brown
);
var text = new NSAttributedString (TextForParagraph (paragraph),
font: UIFont.FromName ("HoeflerText-Regular", 24.0f),
foregroundColor: UIColor.Black
#if TEST_OTHER_ATTRIBUTES
,backgroundColor: UIColor.Yellow,
ligatures: NSLigatureType.None,
kerning: 10,
underlineStyle: NSUnderlineStyle.Single,
shadow: new NSShadow () { ShadowColor = UIColor.Red, ShadowOffset = new System.Drawing.SizeF (5, 5) },
strokeWidth: 5
#endif
);
returnValue.Append (speaker, " ", text);
}
if (Paragraphs.IndexOf (paragraph) == SelectedParagraph) {
returnValue.AddAttribute (UIStringAttributeKey.ForegroundColor, UIColor.White, new NSRange (0, returnValue.Length));
returnValue.AddAttribute (UIStringAttributeKey.BackgroundColor, UIColor.FromHSB (.6f, .6f, .7f), new NSRange (0, returnValue.Length));
}
returnValue.EnumerateAttribute (UIStringAttributeKey.ParagraphStyle, new NSRange (0, returnValue.Length), NSAttributedStringEnumeration.LongestEffectiveRangeNotRequired,
(NSObject value, NSRange range, ref bool stop) => {
var style = value == null ? new NSMutableParagraphStyle () : (NSMutableParagraphStyle)value.MutableCopy ();
style.MinimumLineHeight = LineHeight;
style.MaximumLineHeight = LineHeight;
returnValue.AddAttribute (UIStringAttributeKey.ParagraphStyle, style, range);
});
return returnValue;
}
public string StringForParagraph (XElement paragraph)
{
string speaker = SpeakerForParagraph (paragraph);
string text = TextForParagraph (paragraph);
return speaker + ": " + text;
}
}
}

83
Quotes/PagePreview.cs Normal file
Просмотреть файл

@ -0,0 +1,83 @@
using System;
using System.Drawing;
using MonoTouch.UIKit;
using MonoTouch.CoreFoundation;
using MonoTouch.Foundation;
using MonoTouch.CoreText;
using MonoTouch.CoreGraphics;
namespace Quotes
{
public partial class PagePreview : UICollectionViewCell
{
Page cellPage;
[Export ("initWithCoder:")]
public PagePreview (NSCoder c) : base (c)
{
}
public PagePreview ()
{
}
public Page Page {
get {
return cellPage;
}
set {
cellPage = value;
var textShadow = new NSShadow () {
ShadowOffset = new SizeF (3, 3),
ShadowBlurRadius = 2
};
var attrs = new NSMutableDictionary () {
{ UIStringAttributeKey.Shadow, textShadow },
{ UIStringAttributeKey.ForegroundColor, UIColor.Red },
};
var attributedTitle = new NSMutableAttributedString (Page.Title, attrs);
var bold = UIFont.BoldSystemFontOfSize (17);
var dashPos = attributedTitle.Value.IndexOf ("-");
var rangeOfPlayName = new NSRange (dashPos + 1, attributedTitle.Value.Length - dashPos - 1);
textLabel.TextAlignment = UITextAlignment.Center;
textLabel.LineBreakMode = UILineBreakMode.WordWrap;
textLabel.Lines = 0;
attributedTitle.AddAttribute (UIStringAttributeKey.Font, bold, rangeOfPlayName);
textLabel.AttributedText = attributedTitle;
pageImageView.Image = new PageView (pageImageView.Frame).RenderPagePreview (Page, pageImageView.Frame.Size);
}
}
public override bool Highlighted {
get {
return base.Highlighted;
}
set {
base.Highlighted = value;
if (value) {
textLabel.Layer.CornerRadius = 7.5f;
textLabel.BackgroundColor = UIColor.FromHSBA (0.6f, 0.6f, 0.7f, 1);
} else {
textLabel.Layer.CornerRadius = 0.0f;
textLabel.BackgroundColor = UIColor.Clear;
}
}
}
public void DoSomeWorkThatTakesLong ()
{
// we don't have anything to do. Simulate a long-running task by calling sleep.
// That is okay here because we are in a demo and not running on the main thread.
NSThread.SleepFor (2.0);
}
}
}

33
Quotes/PagePreview.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,33 @@
// 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 Quotes
{
[Register ("PagePreview")]
partial class PagePreview
{
[Outlet]
MonoTouch.UIKit.UIImageView pageImageView { get; set; }
[Outlet]
MonoTouch.UIKit.UILabel textLabel { get; set; }
void ReleaseDesignerOutlets ()
{
if (pageImageView != null) {
pageImageView.Dispose ();
pageImageView = null;
}
if (textLabel != null) {
textLabel.Dispose ();
textLabel = null;
}
}
}
}

241
Quotes/PagePreview.xib Normal file
Просмотреть файл

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">12A269</string>
<string key="IBDocument.InterfaceBuilderVersion">2818</string>
<string key="IBDocument.AppKitVersion">1187</string>
<string key="IBDocument.HIToolboxVersion">624.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1900</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUICollectionViewCell</string>
<string>IBUIImageView</string>
<string>IBUILabel</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="606714003">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUICollectionViewCell" id="248054880">
<reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIView" id="698496677">
<reference key="NSNextResponder" ref="248054880"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIImageView" id="505218569">
<reference key="NSNextResponder" ref="698496677"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{20, 20}, {160, 213}}</string>
<reference key="NSSuperview" ref="698496677"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="400316784"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUILabel" id="400316784">
<reference key="NSNextResponder" ref="698496677"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{8, 241}, {184, 44}}</string>
<reference key="NSSuperview" ref="698496677"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<string key="IBUIText">Label</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
<int key="IBUIAutoshrinkMode">0</int>
</object>
</array>
<string key="NSFrameSize">{200, 290}</string>
<reference key="NSSuperview" ref="248054880"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="505218569"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">4</int>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</array>
<string key="NSFrameSize">{200, 290}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="698496677"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">4</int>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSValue" key="IBUICustomSize">
<int key="NS.special">2</int>
<string key="NS.sizeval">{200, 290}</string>
</object>
<reference key="IBUIContentView" ref="698496677"/>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">pageImageView</string>
<reference key="source" ref="248054880"/>
<reference key="destination" ref="505218569"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">textLabel</string>
<reference key="source" ref="248054880"/>
<reference key="destination" ref="400316784"/>
</object>
<int key="connectionID">15</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<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="606714003"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="248054880"/>
<array class="NSMutableArray" key="children">
<reference ref="505218569"/>
<reference ref="400316784"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="505218569"/>
<reference key="parent" ref="248054880"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="400316784"/>
<reference key="parent" ref="248054880"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">PagePreview</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.CustomClassName">PagePreview</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">15</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">PagePreview</string>
<string key="superclassName">UICollectionViewCell</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="pageImageView">UIImageView</string>
<string key="textLabel">UILabel</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="pageImageView">
<string key="name">pageImageView</string>
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo" key="textLabel">
<string key="name">textLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/PagePreview.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UICollectionReusableView</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UICollectionReusableView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UICollectionViewCell</string>
<string key="superclassName">UICollectionReusableView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UICollectionViewCell.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1900</string>
</data>
</archive>

175
Quotes/PageView.cs Normal file
Просмотреть файл

@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreText;
namespace Quotes
{
[Register ("PageView")]
public class PageView : UIImageView
{
Page page;
public bool UnstyledDrawing;
RectangleF[] paragraphBounds;
public PageView (IntPtr handle) : base (handle)
{
}
public PageView (RectangleF rect) : base (rect)
{
}
public void UpdatePage ()
{
Image = RenderPageWithSize (Bounds.Size);
}
public void SetPage (Page p)
{
if (page != p) {
page = p;
UpdatePage ();
}
}
public void SetUnstyledDrawing (bool unstyled)
{
if (UnstyledDrawing != unstyled) {
UnstyledDrawing = unstyled;
UpdatePage ();
}
}
public void SetLineHeight (float lHeight)
{
if (page.LineHeight != lHeight) {
page.LineHeight = lHeight;
UpdatePage ();
}
}
public float GetLineHeight ()
{
return page.LineHeight;
}
public override bool CanBecomeFirstResponder {
get {
return true;
}
}
/*
* Render the page here: we assume we are already in a normalized coordinate system which maps
* our standard aspect ratio (3:4) to (1:1)
* The reason why we do this is to reuse the same drawing code for both the preview and the
* full screen; for full screen rendering, we map the whole view, whereas the preview maps
* the whole preview image to a quarter of the page.
* */
public RectangleF [] RenderPage (Page page, SizeF size, bool unstyledDrawing)
{
var pageRect = new RectangleF (0, 0, size.Width, size.Height);
var paragraphBounds = new RectangleF [page.Paragraphs.Count];
// fill background
UIGraphics.GetCurrentContext ().SetFillColor (UIColor.FromHSBA (0.11f, 0.2f, 1, 1).CGColor);
UIGraphics.GetCurrentContext ().FillRect (pageRect);
pageRect = pageRect.Inset (20, 20);
int i = 0;
foreach (var p in page.Paragraphs) {
var bounds = new RectangleF (pageRect.X, pageRect.Y, 0, 0);
if (UnstyledDrawing) {
var text = new NSString (page.StringForParagraph (p));
var font = UIFont.FromName ("HoeflerText-Regular", 24);
// draw text with the old legacy path, setting the font color to black.
UIGraphics.GetCurrentContext ().SetFillColor (UIColor.Black.CGColor);
bounds.Size = text.DrawString (pageRect, font);
} else {
// TODO: draw attributed text with new string drawing
var text = page.AttributedStringForParagraph (p);
var textContext = new NSStringDrawingContext ();
text.DrawString (pageRect, NSStringDrawingOptions.UsesLineFragmentOrigin, textContext);
bounds = textContext.TotalBounds;
bounds.Offset (pageRect.X, pageRect.Y);
}
paragraphBounds [i++] = bounds;
pageRect.Y += bounds.Height;
}
return paragraphBounds;
}
public void SelectParagraphAtPosition (PointF position, bool shouldShowMenu)
{
page.SelectedParagraph = NSRange.NotFound;
var bounds = RectangleF.Empty;
for (int i = 0; i < paragraphBounds.Length; i++) {
bounds = paragraphBounds [i];
if (bounds.Contains (position.X, position.Y)) {
page.SelectedParagraph = i;
break;
}
}
if (shouldShowMenu) {
BecomeFirstResponder ();
var theMenu = UIMenuController.SharedMenuController;
theMenu.SetTargetRect (bounds, this);
theMenu.Update ();
theMenu.SetMenuVisible (true, true);
} else
UIMenuController.SharedMenuController.SetMenuVisible (false, true);
UpdatePage ();
}
public UIImage RenderPagePreview (Page page, SizeF size)
{
UIGraphics.BeginImageContextWithOptions (size, true, 0.0f);
var scale = CGAffineTransform.MakeScale (0.5f, 0.5f);
UIGraphics.GetCurrentContext ().ConcatCTM (scale);
RenderPage (page, new SizeF (1024, 768), false);
var ret = UIGraphics.GetImageFromCurrentImageContext ();
UIGraphics.EndImageContext ();
return ret;
}
public UIImage RenderPageWithSize (SizeF size)
{
UIGraphics.BeginImageContextWithOptions (size, true, 0.0f);
// render and hang on to paragraph bounds for hit testing
paragraphBounds = RenderPage (page, size, UnstyledDrawing);
var ret = UIGraphics.GetImageFromCurrentImageContext ();
return ret;
}
}
}

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

@ -0,0 +1,59 @@
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Quotes
{
public partial class PageViewController : UIViewController
{
public Page controllerPage { get; set; }
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
pageView.UnstyledDrawing = !NSUserDefaults.StandardUserDefaults.BoolForKey ("DrawWithStyle");
pageView.SetPage (controllerPage);
}
public override void ViewDidDisappear (bool animated)
{
base.ViewDidDisappear (animated);
NSUserDefaults.StandardUserDefaults.SetBool (!pageView.UnstyledDrawing, "DrawWithStyle");
}
public override string Title {
get {
return controllerPage.Title;
}
set {
base.Title = value;
}
}
partial void ParagraphSelected (MonoTouch.UIKit.UILongPressGestureRecognizer sender)
{
pageView.SelectParagraphAtPosition (sender.LocationInView (pageView),
sender.State == MonoTouch.UIKit.UIGestureRecognizerState.Ended);
}
partial void DrawingModeToggled (MonoTouch.UIKit.UISwipeGestureRecognizer sender)
{
pageView.UnstyledDrawing = !pageView.UnstyledDrawing;
pageView.UpdatePage ();
}
partial void MenuDismissed (MonoTouch.UIKit.UITapGestureRecognizer sender)
{
pageView.SelectParagraphAtPosition (new System.Drawing.PointF (-100.0f, -100.0f), false);
}
partial void LineHeightChanged (MonoTouch.UIKit.UISlider sender)
{
pageView.SetLineHeight (sender.Value);
}
}
}

37
Quotes/PageViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,37 @@
// 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 Quotes
{
[Register ("PageViewController")]
partial class PageViewController
{
[Outlet]
Quotes.PageView pageView { get; set; }
[Action ("ParagraphSelected:")]
partial void ParagraphSelected (MonoTouch.UIKit.UILongPressGestureRecognizer sender);
[Action ("DrawingModeToggled:")]
partial void DrawingModeToggled (MonoTouch.UIKit.UISwipeGestureRecognizer sender);
[Action ("MenuDismissed:")]
partial void MenuDismissed (MonoTouch.UIKit.UITapGestureRecognizer sender);
[Action ("LineHeightChanged:")]
partial void LineHeightChanged (MonoTouch.UIKit.UISlider sender);
void ReleaseDesignerOutlets ()
{
if (pageView != null) {
pageView.Dispose ();
pageView = null;
}
}
}
}

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

@ -0,0 +1,510 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">12A269</string>
<string key="IBDocument.InterfaceBuilderVersion">2829</string>
<string key="IBDocument.AppKitVersion">1187</string>
<string key="IBDocument.HIToolboxVersion">624.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1914</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBNSLayoutConstraint</string>
<string>IBProxyObject</string>
<string>IBUILongPressGestureRecognizer</string>
<string>IBUISlider</string>
<string>IBUISwipeGestureRecognizer</string>
<string>IBUITapGestureRecognizer</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="606714003">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUIView" id="766721923">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIView" id="559966424">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUISlider" id="434030447">
<reference key="NSNextResponder" ref="559966424"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{527, 962}, {223, 23}}</string>
<reference key="NSSuperview" ref="559966424"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<float key="IBUIValue">25</float>
<float key="IBUIMinValue">15</float>
<float key="IBUIMaxValue">35</float>
<object class="NSColor" key="IBUIMinimumTrackTintColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4wNzk1MTgzNzAzMyAwLjQyNTg5OTI2NzIgMC4yMzkwMjE0NTAzAA</bytes>
</object>
<object class="NSColor" key="IBUIMaximumTrackTintColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC43MzA5NzU3NDcxIDAuNjcyNjE4MTUwNyAwLjU0Nzk3Mjc5ODMAA</bytes>
</object>
<object class="NSColor" key="IBUIThumbTintColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC43MzA5NzU3NDcxIDAuNjcyNjE4MTUwNyAwLjU0Nzk3Mjc5ODMAA</bytes>
</object>
</object>
</array>
<string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="434030447"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="893163871">
<int key="NSID">2</int>
</object>
</object>
<int key="IBUIContentMode">5</int>
<array key="IBUIGestureRecognizers" id="0"/>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</array>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="559966424"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="893163871"/>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUILongPressGestureRecognizer" id="709327395"/>
<object class="IBUISwipeGestureRecognizer" id="524986906"/>
<object class="IBUITapGestureRecognizer" id="367261491"/>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="766721923"/>
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">pageView</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="559966424"/>
</object>
<int key="connectionID">74</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletCollectionConnection" key="connection">
<string key="label">gestureRecognizers</string>
<reference key="source" ref="559966424"/>
<reference key="destination" ref="709327395"/>
<string key="cachedDesigntimeCollectionClassName">NSArray</string>
<bool key="addsContentToExistingCollection">YES</bool>
</object>
<int key="connectionID">41</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletCollectionConnection" key="connection">
<string key="label">gestureRecognizers</string>
<reference key="source" ref="559966424"/>
<reference key="destination" ref="524986906"/>
<string key="cachedDesigntimeCollectionClassName">NSArray</string>
<bool key="addsContentToExistingCollection">YES</bool>
</object>
<int key="connectionID">44</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletCollectionConnection" key="connection">
<string key="label">gestureRecognizers</string>
<reference key="source" ref="559966424"/>
<reference key="destination" ref="367261491"/>
<string key="cachedDesigntimeCollectionClassName">NSArray</string>
<bool key="addsContentToExistingCollection">YES</bool>
</object>
<int key="connectionID">57</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">ParagraphSelected:</string>
<reference key="source" ref="709327395"/>
<reference key="destination" ref="841351856"/>
</object>
<int key="connectionID">69</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">DrawingModeToggled:</string>
<reference key="source" ref="524986906"/>
<reference key="destination" ref="841351856"/>
</object>
<int key="connectionID">70</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">LineHeightChanged:</string>
<reference key="source" ref="434030447"/>
<reference key="destination" ref="841351856"/>
<int key="IBEventType">13</int>
</object>
<int key="connectionID">72</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">MenuDismissed:</string>
<reference key="source" ref="367261491"/>
<reference key="destination" ref="841351856"/>
</object>
<int key="connectionID">71</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<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="841351856"/>
<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="606714003"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="766721923"/>
<array class="NSMutableArray" key="children">
<object class="IBNSLayoutConstraint" id="1021826094">
<reference key="firstItem" ref="559966424"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
<reference key="secondItem" ref="766721923"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="766721923"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="124959283">
<reference key="firstItem" ref="559966424"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="766721923"/>
<int key="secondAttribute">5</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="766721923"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="674168297">
<reference key="firstItem" ref="559966424"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
<reference key="secondItem" ref="766721923"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="766721923"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="815412784">
<reference key="firstItem" ref="559966424"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="766721923"/>
<int key="secondAttribute">3</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="766721923"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<reference ref="559966424"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">25</int>
<reference key="object" ref="559966424"/>
<array class="NSMutableArray" key="children">
<reference ref="434030447"/>
<object class="IBNSLayoutConstraint" id="860708536">
<reference key="firstItem" ref="559966424"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
<reference key="secondItem" ref="434030447"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="559966424"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="658693">
<reference key="firstItem" ref="559966424"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
<reference key="secondItem" ref="434030447"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="559966424"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
</array>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">40</int>
<reference key="object" ref="709327395"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="524986906"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">46</int>
<reference key="object" ref="434030447"/>
<array class="NSMutableArray" key="children">
<object class="IBNSLayoutConstraint" id="716910066">
<reference key="firstItem" ref="434030447"/>
<int key="firstAttribute">7</int>
<int key="relation">0</int>
<nil key="secondItem"/>
<int key="secondAttribute">0</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">219</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="434030447"/>
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">1</int>
</object>
</array>
<reference key="parent" ref="559966424"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">48</int>
<reference key="object" ref="658693"/>
<reference key="parent" ref="559966424"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">49</int>
<reference key="object" ref="860708536"/>
<reference key="parent" ref="559966424"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">50</int>
<reference key="object" ref="716910066"/>
<reference key="parent" ref="434030447"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">56</int>
<reference key="object" ref="367261491"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">34</int>
<reference key="object" ref="124959283"/>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">30</int>
<reference key="object" ref="815412784"/>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">35</int>
<reference key="object" ref="1021826094"/>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">32</int>
<reference key="object" ref="674168297"/>
<reference key="parent" ref="766721923"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">PageViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<array class="NSMutableArray" key="2.IBViewMetadataConstraints">
<reference ref="815412784"/>
<reference ref="674168297"/>
<reference ref="124959283"/>
<reference ref="1021826094"/>
</array>
<string key="25.CustomClassName">PageView</string>
<string key="25.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<array key="25.IBViewMetadataConstraints">
<reference ref="658693"/>
<reference ref="860708536"/>
</array>
<boolean value="NO" key="25.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="30.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="32.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="34.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="35.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="40.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="43.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="46.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<array class="NSMutableArray" key="46.IBViewMetadataConstraints">
<reference ref="716910066"/>
</array>
<boolean value="NO" key="46.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="48.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="49.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="50.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">74</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">NSLayoutConstraint</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSLayoutConstraint.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PageView</string>
<string key="superclassName">UIImageView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/PageView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PageViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="DrawingModeToggled:">UISwipeGestureRecognizer</string>
<string key="LineHeightChanged:">UISlider</string>
<string key="MenuDismissed:">UITapGestureRecognizer</string>
<string key="ParagraphSelected:">UILongPressGestureRecognizer</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="DrawingModeToggled:">
<string key="name">DrawingModeToggled:</string>
<string key="candidateClassName">UISwipeGestureRecognizer</string>
</object>
<object class="IBActionInfo" key="LineHeightChanged:">
<string key="name">LineHeightChanged:</string>
<string key="candidateClassName">UISlider</string>
</object>
<object class="IBActionInfo" key="MenuDismissed:">
<string key="name">MenuDismissed:</string>
<string key="candidateClassName">UITapGestureRecognizer</string>
</object>
<object class="IBActionInfo" key="ParagraphSelected:">
<string key="name">ParagraphSelected:</string>
<string key="candidateClassName">UILongPressGestureRecognizer</string>
</object>
</dictionary>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">pageView2</string>
<string key="NS.object.0">PageView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">pageView2</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">pageView2</string>
<string key="candidateClassName">PageView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/PageViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
<string key="IBCocoaTouchPluginVersion">1914</string>
</data>
</archive>

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

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<array>
<dict>
<key>text</key>
<string>Nacht.
In einem hochgewölbten, engen gotischen Zimmer Faust,
unruhig auf seinem Sessel am Pulte.</string>
<key>speaker</key>
<string>STAGE DIRECTION</string>
</dict>
<dict>
<key>text</key>
<string>Habe nun, ach! Philosophie,
Juristerei und Medizin,
Und leider auch Theologie
Durchaus studiert, mit heißem Bemühn.
Da steh ich nun, ich armer Tor!
Und bin so klug als wie zuvor;
Heiße Magister, heiße Doktor gar
Und ziehe schon an die zehen Jahr
Herauf, herab und quer und krumm
Meine Schüler an der Nase herum-
Und sehe, daß wir nichts wissen können!
Das will mir schier das Herz verbrennen.
Zwar bin ich gescheiter als all die Laffen,
Doktoren, Magister, Schreiber und Pfaffen;
Mich plagen keine Skrupel noch Zweifel,
Fürchte mich weder vor Hölle noch Teufel-
Dafür ist mir auch alle Freud entrissen,
Bilde mir nicht ein, was Rechts zu wissen,
Bilde mir nicht ein, ich könnte was lehren,
Die Menschen zu bessern und zu bekehren.
Auch hab ich weder Gut noch Geld,
Noch Ehr und Herrlichkeit der Welt;
Es möchte kein Hund so länger leben!
Drum hab ich mich der Magie ergeben,
Ob mir durch Geistes Kraft und Mund
Nicht manch Geheimnis würde kund;
Daß ich nicht mehr mit saurem Schweiß
Zu sagen brauche, was ich nicht weiß;
Daß ich erkenne, was die Welt
Im Innersten zusammenhält,
Schau alle Wirkenskraft und Samen,
Und tu nicht mehr in Worten kramen.</string>
<key>speaker</key>
<string>FAUST</string>
</dict>
</array>

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

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<array>
<dict>
<key>text</key>
<string>Stay, ho, and let us hear Mark Antony.</string>
<key>speaker</key>
<string>FIRST CITIZEN</string>
</dict>
<dict>
<key>text</key>
<string>Let him go up into the public chair;
We'll hear him. Noble Antony, go up.</string>
<key>speaker</key>
<string>THIRD CITIZEN</string>
</dict>
<dict>
<key>text</key>
<string>For Brutus' sake, I am beholding to you.</string>
<key>speaker</key>
<string>ANTONY</string>
</dict>
<dict>
<key>text</key>
<string>Goes into the pulpit.</string>
<key>speaker</key>
<string>STAGE DIRECTION</string>
</dict>
<dict>
<key>text</key>
<string>What does he say of Brutus?</string>
<key>speaker</key>
<string>FOURTH CITIZEN</string>
</dict>
<dict>
<key>speaker</key>
<string>THIRD CITIZEN</string>
<key>text</key>
<string>He says, for Brutus' sake,
He finds himself beholding to us all</string>
</dict>
<dict>
<key>speaker</key>
<string>FOURTH CITIZEN</string>
<key>text</key>
<string>'Twere best he speak no harm of Brutus here.</string>
</dict>
<dict>
<key>speaker</key>
<string>FIRST CITIZEN</string>
<key>text</key>
<string>This Caesar was a tyrant.</string>
</dict>
<dict>
<key>speaker</key>
<string>THIRD CITIZEN</string>
<key>text</key>
<string>Nay, that's certain.
We are blest that Rome is rid of him</string>
</dict>
<dict>
<key>speaker</key>
<string>SECOND CITIZEN</string>
<key>text</key>
<string>Waffles! Let us hear what Antony can say.</string>
</dict>
<dict>
<key>speaker</key>
<string>ANTONY</string>
<key>text</key>
<string>You gentle Romans-</string>
</dict>
<dict>
<key>speaker</key>
<string>ALL</string>
<key>text</key>
<string>Peace, ho! Let us hear him.</string>
</dict>
<dict>
<key>speaker</key>
<string>ANTONY</string>
<key>text</key>
<string>Friends, Romans, countrymen, lend me your ears!
I come to bury Caesar, not to praise him.
The evil that men do lives after them,
The good is oft interred with their bones;
So let it be with Caesar. The noble Brutus
Hath told you Caesar was ambitious;
If it were so, it was a grievous fault,
And grievously hath Caesar answer'd it.
Here, under leave of Brutus and the rest-
For Brutus is an honorable man;
So are they all, all honorable men-
Come I to speak in Caesar's funeral.
He was my friend, faithful and just to me;
But Brutus says he was ambitious,
And Brutus is an honorable man.
He hath brought many captives home to Rome,
Whose ransoms did the general coffers fill.
Did this in Caesar seem ambitious?
When that the poor have cried, Caesar hath wept;
Ambition should be made of sterner stuff:
Yet Brutus says he was ambitious,
And Brutus is an honorable man.
You all did see that on the Lupercal
I thrice presented him a kingly crown,
Which he did thrice refuse. Was this ambition?
Yet Brutus says he was ambitious,
And sure he is an honorable man.
I speak not to disprove what Brutus spoke,
But here I am to speak what I do know.
You all did love him once, not without cause;
What cause withholds you then to mourn for him?
O judgement, thou art fled to brutish beasts,
And men have lost their reason. Bear with me;
My heart is in the coffin there with Caesar,
And I must pause till it come back to me.
</string>
</dict>
</array>

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

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<array>
<dict>
<key>text</key>
<string>First, rehearse your song by rote,
To each word a warbling note;
Hand in hand, with fairy grace,
Will we sing, and bless this place.</string>
<key>speaker</key>
<string>TITANIA</string>
</dict>
<dict>
<key>text</key>
<string>OBERON leading, the FAIRIES sing and dance</string>
<key>speaker</key>
<string>STAGE DIRECTION</string>
</dict>
<dict>
<key>text</key>
<string>Now, until the break of day,
Through this house each fairy stray.
To the best bride-bed will we,
Which by us shall blessed be;
And the issue there create
Ever shall be fortunate.
So shall all the couples three
Ever true in loving be;
And the blots of Nature&apos;s hand
Shall not in their issue stand;
Never mole, hare-lip, nor scar,
Nor mark prodigious, such as are
Despised in nativity,
Shall upon their children be.
With this field-dew consecrate,
Every fairy take his gait,
And each several chamber bless,
Through this palace, with sweet peace;
And the owner of it blest
Ever shall in safety rest.
Trip away; make no stay;
Meet me all by break of day.</string>
<key>speaker</key>
<string>OBERON</string>
</dict>
<dict>
<key>text</key>
<string>Exeunt all but PUCK</string>
<key>speaker</key>
<string>STAGE DIRECTION</string>
</dict>
<dict>
<key>text</key>
<string>If we shadows have offended,
Think but this, and all is mended,
That you have but slumb&apos;red here
While these visions did appear.
And this weak and idle theme,
No more yielding but a dream,
Gentles, do not reprehend.
If you pardon, we will mend.
And, as I am an honest Puck,
If we have unearned luck
Now to scape the serpent&apos;s tongue,
We will make amends ere long;
Else the Puck a liar call.
So, good night unto you all.
Give me your hands, if we be friends,
And Robin shall restore amends.</string>
<key>speaker</key>
<string>PUCK</string>
</dict>
<dict>
<key>text</key>
<string>Exit</string>
<key>speaker</key>
<string>STAGE DIRECTION</string>
</dict>
</array>

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

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<array>
<dict>
<key>text</key>
<string>O, then I see Queen Mab hath been with you.
She is the fairies&apos; midwife, and she comes
In shape no bigger than an agate stone
On the forefinger of an alderman,
Drawn with a team of little atomies
Athwart men&apos;s noses as they lie asleep;
Her wagon spokes made of long spinners&apos; legs,
The cover, of the wings of grasshoppers;
Her traces, of the smallest spider&apos;s web;
Her collars, of the moonshine&apos;s wat&apos;ry beams;
Her whip, of cricket&apos;s bone; the lash, of film;
Her wagoner, a small grey-coated gnat,
Not half so big as a round little worm
Prick&apos;d from the lazy finger of a maid;
Her chariot is an empty hazelnut,
Made by the joiner squirrel or old grub,
Time out o&apos; mind the fairies&apos; coachmakers.
And in this state she &apos;gallops night by night
Through lovers&apos; brains, and then they dream of love;
O&apos;er courtiers&apos; knees, that dream on cursies straight;
O&apos;er lawyers&apos; fingers, who straight dream on fees;
O&apos;er ladies&apos; lips, who straight on kisses dream,
Which oft the angry Mab with blisters plagues,
Because their breaths with sweetmeats tainted are.
Sometime she gallops o&apos;er a courtier&apos;s nose,
And then dreams he of smelling out a suit;
And sometime comes she with a tithe-pig&apos;s tail
Tickling a parson&apos;s nose as &apos;a lies asleep,
Then dreams he of another benefice.
Sometimes she driveth o&apos;er a soldier&apos;s neck,
And then dreams he of cutting foreign throats,
Of breaches, ambuscadoes, Spanish blades,
Of healths five fadom deep; and then anon
Drums in his ear, at which he starts and wakes,
And being thus frighted, swears a prayer or two
And sleeps again. This is that very Mab
That plats the manes of horses in the night
And bakes the elflocks in foul sluttish, hairs,
Which once untangled much misfortune bodes
This is the hag, when maids lie on their backs,
That presses them and learns them first to bear,
Making them women of good carriage.</string>
<key>speaker</key>
<string>MERCUTIO</string>
</dict>
<dict>
<key>text</key>
<string>Peace, peace, Mercutio, peace!
Thou talk&apos;st of nothing.</string>
<key>speaker</key>
<string>ROMEO</string>
</dict>
</array>

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

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<array>
<dict>
<key>text</key>
<string>Time hath, my lord, a wallet at his back,
Wherein he puts alms for oblivion,
A great-siz&apos;d monster of ingratitudes.
Those scraps are good deeds past, which are devour&apos;d
As fast as they are made, forgot as soon
As done. Perseverance, dear my lord,
Keeps honour bright. To have done is to hang
Quite out of fashion, like a rusty mail
In monumental mock&apos;ry. Take the instant way;
For honour travels in a strait so narrow -
Where one but goes abreast. Keep then the path,
For emulation hath a thousand sons
That one by one pursue; if you give way,
Or hedge aside from the direct forthright,
Like to an ent&apos;red tide they all rush by
And leave you hindmost;
Or, like a gallant horse fall&apos;n in first rank,
Lie there for pavement to the abject rear,
O&apos;er-run and trampled on. Then what they do in present,
Though less than yours in past, must o&apos;ertop yours;
For Time is like a fashionable host,
That slightly shakes his parting guest by th&apos; hand;
And with his arms out-stretch&apos;d, as he would fly,
Grasps in the corner. The welcome ever smiles,
And farewell goes out sighing. O, let not virtue seek
Remuneration for the thing it was;
For beauty, wit,
High birth, vigour of bone, desert in service,
Love, friendship, charity, are subjects all
To envious and calumniating Time.
One touch of nature makes the whole world kin-
That all with one consent praise new-born gawds,
Though they are made and moulded of things past,
And give to dust that is a little gilt
More laud than gilt o&apos;er-dusted.
The present eye praises the present object.
Then marvel not, thou great and complete man,
That all the Greeks begin to worship Ajax,
Since things in motion sooner catch the eye
Than what stirs not. The cry went once on thee,
And still it might, and yet it may again,
If thou wouldst not entomb thyself alive
And case thy reputation in thy tent,
Whose glorious deeds but in these fields of late
Made emulous missions &apos;mongst the gods themselves,
And drave great Mars to faction.</string>
<key>speaker</key>
<string>ULYSSES</string>
</dict>
<dict>
<key>text</key>
<string>Of this my privacy
I have strong reasons.</string>
<key>speaker</key>
<string>ACHILLES</string>
</dict>
<dict>
<key>speaker</key>
<string>ULYSSES</string>
<key>text</key>
<string>But &apos;gainst your privacy
The reasons are more potent and heroical.
&apos;Tis known, Achilles, that you are in love
With one of Priam&apos;s daughters.</string>
</dict>
</array>

146
Quotes/Quotes.csproj Normal file
Просмотреть файл

@ -0,0 +1,146 @@
<?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>{13C07F78-2F93-4810-A6E9-7FDDDE55983A}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Quotes</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
</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>
<MtouchLink>None</MtouchLink>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchArch>ARMv7</MtouchArch>
<AssemblyName>Quotes</AssemblyName>
<MtouchI18n />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchLink>None</MtouchLink>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyName>Quotes</AssemblyName>
<MtouchArch>ARMv7</MtouchArch>
<MtouchI18n />
</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>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchArch>ARMv7</MtouchArch>
<MtouchI18n />
<AssemblyName>WWDCQuotes</AssemblyName>
<IpaPackageName />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyName>WWDCQuotes</AssemblyName>
<MtouchArch>ARMv7</MtouchArch>
<MtouchI18n />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<BuildIpa>True</BuildIpa>
<CodesignKey>iPhone Distribution</CodesignKey>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyName>WWDCQuotes</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyName>WWDCQuotes</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppDelegate.cs" />
<Compile Include="Page.cs" />
<Compile Include="PageView.cs" />
<Compile Include="MasterViewController.cs" />
<Compile Include="PageViewController.cs" />
<Compile Include="PageViewController.designer.cs">
<DependentUpon>PageViewController.cs</DependentUpon>
</Compile>
<Compile Include="PagePreview.cs" />
<Compile Include="PagePreview.designer.cs">
<DependentUpon>PagePreview.cs</DependentUpon>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Images\" />
<Folder Include="Pages\" />
</ItemGroup>
<ItemGroup>
<Content Include="Default.png" />
<Content Include="Images\29_icon.png" />
<Content Include="Images\50_icon.png" />
<Content Include="Images\57_icon.png" />
<Content Include="Images\58_icon.png" />
<Content Include="Images\72_icon.png" />
<Content Include="Images\100_icon.png" />
<Content Include="Images\114_icon.png" />
<Content Include="Images\144_icon.png" />
<Content Include="Pages\Julius Caesar - Antony%27s speech.xml" />
<Content Include="Pages\Midsummer Night%27s Dream - Exit speech.xml" />
<Content Include="Pages\Romeo &amp; Juliet - Queen Mab.xml" />
<Content Include="Pages\Troilus and Cressida - Ulysses.xml" />
<Content Include="Pages\Faust - Erste Szene.xml" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="PageViewController.xib" />
<InterfaceDefinition Include="PagePreview.xib" />
</ItemGroup>
</Project>

32
Quotes/Quotes.sln Normal file
Просмотреть файл

@ -0,0 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quotes", "Quotes.csproj", "{13C07F78-2F93-4810-A6E9-7FDDDE55983A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Ad-Hoc|iPhone = Ad-Hoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.AppStore|iPhone.Build.0 = AppStore|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Debug|iPhone.ActiveCfg = Debug|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Debug|iPhone.Build.0 = Debug|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Release|iPhone.ActiveCfg = Release|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Release|iPhone.Build.0 = Release|iPhone
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{13C07F78-2F93-4810-A6E9-7FDDDE55983A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Quotes.csproj
EndGlobalSection
EndGlobal

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

@ -0,0 +1,14 @@
Quotes
======
This is a port of the WWDC2012 of the same name
This sample application utilizes the legacy string drawing functions
and the new attributed string drawing. Various usages and functionality
of attributed strings are demonstrated in this sample.
Perform a swipe gesture to enter drawing mode, which changes speaker
text color, italicizes and centers stage direction, and enables the
slider on the bottom right.
Ported by: Peter Collins

Двоичные данные
Quotes/ScreenShots/Screen Shot 2012-08-24 at 5.16.35 PM.png Normal file

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

После

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

Двоичные данные
Quotes/ScreenShots/Screen Shot 2012-08-24 at 5.16.46 PM.png Normal file

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

После

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

Двоичные данные
Quotes/ScreenShots/Screen Shot 2012-08-24 at 5.16.53 PM.png Normal file

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

После

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

Двоичные данные
Quotes/ScreenShots/Screen Shot 2012-08-24 at 5.17.25 PM.png Normal file

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

После

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

Двоичные данные
Quotes/ScreenShots/Screen Shot 2012-08-24 at 5.17.31 PM.png Normal file

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

После

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

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

@ -0,0 +1,51 @@
RegionDefiner
=============
This is a MonoTouch port of the WWDC2012 sample of the same name
showing how to get around with MapKit.
Description:
============
This sample is an example to generate GeoJSON coverage files for use
with the Maps routing apps API.
RegionDefiner
=============
Sample app opens with MapView, Reset and Log Button.
On longpressing any point on the map an annotation is added as pin
point with map coordinate information. A multipolygon is defined when
3 or more pinpoints are added to the map. On pressing reset button,
the annotations and region defined are erased. Log button logs the
coordinate information. Logs can be checked in Device Log.
Packaging List:
AppDelegate
- A basic UIApplication delegate which sets up the application.
ViewController
- A UIViewController subclass which shows a map
MyAnnotation
- Represents a point on the map
Changes From Previous Version:
Version 1.0
- First version.
Ported By: GouriKumari

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

@ -0,0 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegionDefiner", "RegionDefiner\RegionDefiner.csproj", "{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Ad-Hoc|iPhone = Ad-Hoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.AppStore|iPhone.Build.0 = AppStore|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Debug|iPhone.ActiveCfg = Debug|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Debug|iPhone.Build.0 = Debug|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Release|iPhone.ActiveCfg = Release|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Release|iPhone.Build.0 = Release|iPhone
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = RegionDefiner\RegionDefiner.csproj
EndGlobalSection
EndGlobal

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

@ -0,0 +1,33 @@
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace RegionDefiner
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
RegionDefinerViewController viewController;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
viewController = new RegionDefinerViewController ();
window.RootViewController = viewController;
window.MakeKeyAndVisible ();
return true;
}
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");
}
}
}

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

@ -0,0 +1,10 @@
using System;
using MonoTouch.UIKit;
namespace RegionDefiner
{
public class GestureDelegate : UIGestureRecognizerDelegate
{
}
}

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

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

После

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

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

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

После

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

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

@ -0,0 +1,29 @@
<?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>CFBundleIconFiles</key>
<array>
<string>Images/72_icon.png</string>
</array>
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleDisplayName</key>
<string>Region Definer</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.regiondefiner</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>6.0</string>
</dict>
</plist>

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

@ -0,0 +1,29 @@
using System;
using MonoTouch.MapKit;
using MonoTouch.UIKit;
namespace RegionDefiner
{
public class MapDelegate : MKMapViewDelegate
{
public override MKOverlayView GetViewForOverlay (MKMapView mapView, MonoTouch.Foundation.NSObject overlay)
{
if (RegionDefinerViewController.PolygonView != null && RegionDefinerViewController.PolygonView.Polygon == RegionDefinerViewController.Polygon)
return RegionDefinerViewController.PolygonView;
RegionDefinerViewController.Polygon = overlay as MKPolygon;
RegionDefinerViewController.PolygonView = new MKPolygonView (RegionDefinerViewController.Polygon) {
FillColor = new UIColor (0, 1, 0, .3f),
StrokeColor = new UIColor (0, 1, 0, 0.9f),
LineWidth = 1.0f
};
return RegionDefinerViewController.PolygonView;
}
}
}

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

@ -0,0 +1,38 @@
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.MapKit;
using MonoTouch.CoreLocation;
namespace RegionDefiner
{
public class MyAnnotation : MKAnnotation
{
string title;
string subtitle ;
public MyAnnotation (CLLocationCoordinate2D coordinate, string _title, string _subtitle)
{
Coordinate = coordinate;
title = _title;
subtitle = _subtitle;
}
public override string Title {
get {
return title;
}
}
public override string Subtitle {
get {
return subtitle;
}
}
public override CLLocationCoordinate2D Coordinate { get; set; }
}
}

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

@ -0,0 +1,111 @@
<?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>{FE9AAC77-AFB1-4ED8-9621-7C3A1C00D9B1}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>RegionDefiner</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>RegionDefiner</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>
<ConsolePause>False</ConsolePause>
<MtouchDebug>True</MtouchDebug>
<MtouchLink>None</MtouchLink>
<MtouchArch>ARMv7</MtouchArch>
<MtouchI18n />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchLink>None</MtouchLink>
</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>
<IpaPackageName />
<MtouchArch>ARMv7</MtouchArch>
<MtouchI18n />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<BuildIpa>True</BuildIpa>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="..\README.md">
<Link>README.md</Link>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="AppDelegate.cs" />
<Compile Include="MapDelegate.cs" />
<Compile Include="GestureDelegate.cs" />
<Compile Include="MyAnnotation.cs" />
<Compile Include="RegionDefinerViewController.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Content Include="Images\72_icon.png" />
<Content Include="Images\Default-Portrait~ipad.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images\" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Default-Portrait.png" />
</ItemGroup>
</Project>

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

@ -0,0 +1,134 @@
using System;
using System.Drawing;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using MonoTouch.MapKit;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreLocation;
namespace RegionDefiner
{
public partial class RegionDefinerViewController : UIViewController
{
MKMapView mainMapView;
UILongPressGestureRecognizer longPress;
MyAnnotation droppedPin;
static List<MyAnnotation> itemsArray;
public static MKPolygon Polygon { get ; set; }
public static MKPolygonView PolygonView { get; set; }
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
SizeF containerSize = View.Bounds.Size;
mainMapView = new MKMapView () {
UserInteractionEnabled = true,
Delegate = new MapDelegate (),
ScrollEnabled = true,
};
var toolbar = new UIToolbar () {
AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth,
};
toolbar.SizeToFit ();
SizeF toolbarSize = toolbar.Bounds.Size;
toolbar.Frame = new RectangleF (0, containerSize.Height - toolbarSize.Height, containerSize.Width, toolbarSize.Height);
mainMapView.Frame = new RectangleF (0, 0, containerSize.Width, containerSize.Height - toolbarSize.Height);
var resetButton = new UIBarButtonItem ("Reset", UIBarButtonItemStyle.Bordered, removePins);
var flexibleSpace = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null, null);
var share = new UIBarButtonItem ("Log", UIBarButtonItemStyle.Bordered, tappedShare);
View.AddSubview (mainMapView);
View.AddSubview (toolbar);
toolbar.SetItems (new UIBarButtonItem [] {
resetButton,
flexibleSpace,
share
}, true);
setUpGesture ();
itemsArray = new List<MyAnnotation> ();
}
public void setUpGesture ()
{
longPress = new UILongPressGestureRecognizer ();
longPress.AddTarget (this, new MonoTouch.ObjCRuntime.Selector ("HandleLongPress"));
longPress.Delegate = new GestureDelegate ();
View.AddGestureRecognizer (longPress);
}
[MonoTouch.Foundation.Export("HandleLongPress")]
public void handleLongPress (UILongPressGestureRecognizer recognizer)
{
if (recognizer.State == UIGestureRecognizerState.Began) {
PointF longPressPoint = recognizer.LocationInView (mainMapView);
dropPinAtPoint (longPressPoint);
}
}
public void updatePolygon ()
{
var points = itemsArray.Select (l => l.Coordinate).ToArray ();
if (Polygon != null)
mainMapView.RemoveOverlay (Polygon);
Polygon = MKPolygon.FromCoordinates (points);
mainMapView.AddOverlay (Polygon);
}
public void dropPinAtPoint (PointF pointToConvert)
{
CLLocationCoordinate2D convertedPoint = mainMapView.ConvertPoint (pointToConvert, mainMapView);
String pinTitle = String.Format ("Pin Number {0}", itemsArray.Count);
String subCoordinates = String.Format ("{0},{1}", convertedPoint.Latitude.ToString (), convertedPoint.Longitude.ToString ());
droppedPin = new MyAnnotation (convertedPoint, pinTitle, subCoordinates);
mainMapView.AddAnnotation (droppedPin);
itemsArray.Add (droppedPin);
updatePolygon ();
}
public void removePins (object sender, EventArgs args)
{
if (mainMapView.Annotations != null && Polygon != null) {
mainMapView.RemoveAnnotations (mainMapView.Annotations);
itemsArray.RemoveRange (0, itemsArray.Count);
mainMapView.RemoveOverlay (Polygon);
updatePolygon ();
}
}
public void tappedShare (object sender, EventArgs args)
{
Console.WriteLine (coordinates ());
}
public string coordinates ()
{
if (itemsArray.Count < 3)
return "Minimum of 3 vertices to make polygon";
var masterString = new StringBuilder ("\n" + "{ " + "\"type\"" + ":" + " \"MultiPolygon\"" + ",\n" + " \"coordinates\"" + ":" + " [ " + " \n" + "[ [");
foreach (MyAnnotation pin in itemsArray)
masterString = masterString.AppendFormat (" [{0}, {1}] , \n", pin.Coordinate.Longitude, pin.Coordinate.Latitude);
masterString = masterString.Append ("]]" + "\n" + "]" + "\n" + "}");
masterString = masterString.Replace ("]" + " , \n" + "]]", "] ] ]");
return masterString.ToString ();
}
}
}

Двоичные данные
RegionDefiner/RegionDefiner/Resources/Default-Portrait.png Executable file

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

После

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

Двоичные данные
RegionDefiner/ScreenShots/MV.png Normal file

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

После

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

Двоичные данные
RegionDefiner/ScreenShots/MVRegionDefined_Annotations.png Normal file

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

После

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

Двоичные данные
RegionDefiner/ScreenShots/MV_Log.png Normal file

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

После

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

Двоичные данные
RegionDefiner/ScreenShots/MV_Log2.png Normal file

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

После

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

Двоичные данные
RegionDefiner/ScreenShots/MV_ResetPress.png Normal file

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

После

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