Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit'

  • Loading branch information...
commit e0bf7472b8d57a51cbb55ddfce213a86d38f93a9 0 parents
Kevin McMahon authored
26 CustomTextFieldAlertView.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTextFieldAlertView", "CustomTextFieldAlertView\CustomTextFieldAlertView.csproj", "{132F33CE-493F-4C06-B498-ED884119686D}"
+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
+ {132F33CE-493F-4C06-B498-ED884119686D}.Debug|iPhone.ActiveCfg = Debug|iPhone
+ {132F33CE-493F-4C06-B498-ED884119686D}.Debug|iPhone.Build.0 = Debug|iPhone
+ {132F33CE-493F-4C06-B498-ED884119686D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {132F33CE-493F-4C06-B498-ED884119686D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
+ {132F33CE-493F-4C06-B498-ED884119686D}.Release|iPhone.ActiveCfg = Release|iPhone
+ {132F33CE-493F-4C06-B498-ED884119686D}.Release|iPhone.Build.0 = Release|iPhone
+ {132F33CE-493F-4C06-B498-ED884119686D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {132F33CE-493F-4C06-B498-ED884119686D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = CustomTextFieldAlertView\CustomTextFieldAlertView.csproj
+ EndGlobalSection
+EndGlobal
27 CustomTextFieldAlertView/AppController.cs
@@ -0,0 +1,27 @@
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace CustomTextFieldAlertView
+{
+ [Register ("AppController")]
+ public partial class AppDelegate : UIApplicationDelegate
+ {
+ UIWindow window;
+
+ public override bool FinishedLaunching (UIApplication app, NSDictionary options)
+ {
+ RootView rvc = new RootView();
+
+ window = new UIWindow(UIScreen.MainScreen.Bounds);
+ window.AddSubview(rvc.View);
+ window.MakeKeyAndVisible();
+
+ return true;
+ }
+
+ // This method is required in iPhoneOS 3.0
+ public override void OnActivated (UIApplication application)
+ {
+ }
+ }
+}
86 CustomTextFieldAlertView/CustomTextFieldAlertView.csproj
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{132F33CE-493F-4C06-B498-ED884119686D}</ProjectGuid>
+ <ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>CustomTextFieldAlertView</RootNamespace>
+ <MainNibFile>MainWindow.xib</MainNibFile>
+ <AssemblyName>CustomTextFieldAlertView</AssemblyName>
+ <MtouchSdkVersion>3.0</MtouchSdkVersion>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </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>
+ <PlatformTarget>x86</PlatformTarget>
+ <MtouchLink>None</MtouchLink>
+ <MtouchDebug>True</MtouchDebug>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\iPhoneSimulator\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ <MtouchLink>None</MtouchLink>
+ <MtouchDebug>False</MtouchDebug>
+ </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>
+ <PlatformTarget>x86</PlatformTarget>
+ <MtouchDebug>True</MtouchDebug>
+ <CodesignKey>iPhone Developer</CodesignKey>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\iPhone\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodesignKey>iPhone Developer</CodesignKey>
+ <MtouchDebug>False</MtouchDebug>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="monotouch" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="AppController.cs" />
+ <Compile Include="RootView.xib.cs">
+ <DependentUpon>RootView.xib</DependentUpon>
+ </Compile>
+ <Compile Include="RootView.xib.designer.cs">
+ <DependentUpon>RootView.xib</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="RootView.xib" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties InternalTargetFrameworkVersion="IPhone" />
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project>
BIN  CustomTextFieldAlertView/CustomTextFieldAlertView.pidb
Binary file not shown
16 CustomTextFieldAlertView/Main.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace CustomTextFieldAlertView
+{
+ public class Application
+ {
+ static void Main (string[] args)
+ {
+ UIApplication.Main (args, null, "AppController");
+ }
+ }
+}
321 CustomTextFieldAlertView/RootView.xib
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">768</int>
+ <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">740</string>
+ <string key="IBDocument.AppKitVersion">1038.25</string>
+ <string key="IBDocument.HIToolboxVersion">458.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">62</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="711762367">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">292</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIButton" id="873871848">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 300}, {280, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <object class="NSFont" key="IBUIFont" id="482659628">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Click to Enter Name (Delegate)</string>
+ <object class="NSColor" key="IBUIHighlightedTitleColor" id="761535891">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor" id="92245328">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <object class="IBUILabel" id="635570509">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 143}, {280, 35}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Name Entered Will Show Here</string>
+ <object class="NSColor" key="IBUITextColor" id="367241965">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ <object class="IBUIButton" id="926995303">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 345}, {280, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIFont" ref="482659628"/>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Click to Enter Name (Clicked)</string>
+ <reference key="IBUIHighlightedTitleColor" ref="761535891"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="92245328"/>
+ </object>
+ <object class="IBUILabel" id="1034543116">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 186}, {280, 21}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Where the Name Came From</string>
+ <reference key="IBUITextColor" ref="367241965"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ </object>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">button</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="873871848"/>
+ </object>
+ <int key="connectionID">10</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">nameLabel</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="635570509"/>
+ </object>
+ <int key="connectionID">12</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">buttonForClicked</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="926995303"/>
+ </object>
+ <int key="connectionID">14</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">whereLabel</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="1034543116"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="635570509"/>
+ <reference ref="873871848"/>
+ <reference ref="926995303"/>
+ <reference ref="1034543116"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="711762367"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">8</int>
+ <reference key="object" ref="873871848"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">11</int>
+ <reference key="object" ref="635570509"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">13</int>
+ <reference key="object" ref="926995303"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">15</int>
+ <reference key="object" ref="1034543116"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ <string>11.IBPluginDependency</string>
+ <string>13.IBPluginDependency</string>
+ <string>15.IBPluginDependency</string>
+ <string>8.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>RootView</string>
+ <string>UIResponder</string>
+ <string>{{469, 275}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">16</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">RootView</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>button</string>
+ <string>buttonForClicked</string>
+ <string>nameLabel</string>
+ <string>whereLabel</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+ <integer value="768" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3000" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.1</string>
+ </data>
+</archive>
141 CustomTextFieldAlertView/RootView.xib.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace CustomTextFieldAlertView
+{
+ public partial class RootView : UIViewController
+ {
+ #region Constructors
+
+ // The IntPtr and NSCoder constructors are required for controllers that need
+ // to be able to be created from a xib rather than from managed code
+
+ public RootView (IntPtr handle) : base(handle)
+ {
+ Initialize ();
+ }
+
+ [Export("initWithCoder:")]
+ public RootView (NSCoder coder) : base(coder)
+ {
+ Initialize ();
+ }
+
+ public RootView () : base("RootView", null)
+ {
+ Initialize ();
+ }
+
+ void Initialize ()
+ {
+ }
+
+ #endregion
+
+ public override void ViewDidLoad ()
+ {
+ base.ViewDidLoad ();
+ this.button.TouchDown += delegate(object sender, EventArgs e)
+ {
+ PromptForName(HandlerToUse.Delegate);
+ };
+
+ this.buttonForClicked.TouchDown += delegate(object sender, EventArgs e)
+ {
+ PromptForName(HandlerToUse.Clicked);
+ };
+ }
+
+ private void PromptForName(HandlerToUse handlerType)
+ {
+ UITextField tf = new UITextField (new System.Drawing.RectangleF (12f, 45f, 260f, 25f));
+ tf.BackgroundColor = UIColor.White;
+ tf.UserInteractionEnabled = true;
+ tf.AutocorrectionType = UITextAutocorrectionType.No;
+ tf.AutocapitalizationType = UITextAutocapitalizationType.None;
+ tf.ReturnKeyType = UIReturnKeyType.Done;
+ tf.SecureTextEntry = false; // Set this to true if you want a password-style text masking
+
+ UIAlertView myAlertView = new UIAlertView
+ {
+ Title = "Please enter your name",
+ Message = "this line is hidden"
+ };
+
+ myAlertView.AddButton("Cancel");
+ myAlertView.AddButton("Ok");
+ myAlertView.AddSubview(tf);
+
+ if (handlerType == HandlerToUse.Delegate)
+ {
+ myAlertView.Delegate = new MyAlertDelegate(this);
+ }
+ else
+ {
+ myAlertView.Clicked += HandleMyAlertViewClicked;
+ }
+
+ myAlertView.Transform = MonoTouch.CoreGraphics.CGAffineTransform.MakeTranslation (0f, 110f);
+
+ myAlertView.Show ();
+ }
+
+ void HandleMyAlertViewClicked (object sender, UIButtonEventArgs e)
+ {
+ if(e.ButtonIndex == 1)
+ {
+ string nameEntered = ((UIAlertView) sender).Subviews.OfType<UITextField>().Single().Text;
+
+ this.SetNameGreeting(nameEntered);
+ this.SetWhereLabel("via Clicked");
+ }
+ else
+ {
+ // Cancelled was clicked
+ }
+ }
+
+ public void SetNameGreeting(string name)
+ {
+ this.nameLabel.Text = string.Format("Hello {0}!", name);
+ }
+
+ public void SetWhereLabel(string whereFrom)
+ {
+ this.whereLabel.Text = whereFrom;
+ }
+ }
+ public enum HandlerToUse
+ {
+ Delegate,
+ Clicked
+ }
+
+ public class MyAlertDelegate : UIAlertViewDelegate
+ {
+ RootView viewController;
+
+ public MyAlertDelegate(RootView vc)
+ {
+ this.viewController = vc;
+ }
+
+ public override void Clicked (UIAlertView alertview, int buttonIndex)
+ {
+ if (buttonIndex == 1)
+ {
+ string nameEntered = alertview.Subviews.OfType<UITextField>().Single().Text;
+
+ viewController.SetNameGreeting(nameEntered);
+ viewController.SetWhereLabel("via Delegate");
+ }
+ else
+ {
+ // Cancelled was clicked
+ }
+ }
+ }
+}
69 CustomTextFieldAlertView/RootView.xib.designer.cs
@@ -0,0 +1,69 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.1433
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace CustomTextFieldAlertView {
+
+
+ // Base type probably should be MonoTouch.UIKit.UIViewController or subclass
+ [MonoTouch.Foundation.Register("RootView")]
+ public partial class RootView {
+
+ #pragma warning disable 0169
+ [MonoTouch.Foundation.Connect("view")]
+ private MonoTouch.UIKit.UIView view {
+ get {
+ return ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
+ }
+ set {
+ this.SetNativeField("view", value);
+ }
+ }
+
+ [MonoTouch.Foundation.Connect("button")]
+ private MonoTouch.UIKit.UIButton button {
+ get {
+ return ((MonoTouch.UIKit.UIButton)(this.GetNativeField("button")));
+ }
+ set {
+ this.SetNativeField("button", value);
+ }
+ }
+
+ [MonoTouch.Foundation.Connect("nameLabel")]
+ private MonoTouch.UIKit.UILabel nameLabel {
+ get {
+ return ((MonoTouch.UIKit.UILabel)(this.GetNativeField("nameLabel")));
+ }
+ set {
+ this.SetNativeField("nameLabel", value);
+ }
+ }
+
+ [MonoTouch.Foundation.Connect("buttonForClicked")]
+ private MonoTouch.UIKit.UIButton buttonForClicked {
+ get {
+ return ((MonoTouch.UIKit.UIButton)(this.GetNativeField("buttonForClicked")));
+ }
+ set {
+ this.SetNativeField("buttonForClicked", value);
+ }
+ }
+
+ [MonoTouch.Foundation.Connect("whereLabel")]
+ private MonoTouch.UIKit.UILabel whereLabel {
+ get {
+ return ((MonoTouch.UIKit.UILabel)(this.GetNativeField("whereLabel")));
+ }
+ set {
+ this.SetNativeField("whereLabel", value);
+ }
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.