зеркало из https://github.com/xamarin/ios-samples.git
[SimpleLogin]Adding sample for docs purposes
This commit is contained in:
Родитель
d55ee0d24d
Коммит
9bb7c9d5e2
|
@ -0,0 +1,32 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeOnlyDemo", "CodeOnlyProject\CodeOnlyDemo.csproj", "{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}"
|
||||
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
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = CodeOnlyProject\CodeOnlyDemo.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,28 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace CodeOnlyDemo
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
UIWindow window;
|
||||
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
// create a new window instance based on the screen size
|
||||
window = new UIWindow(UIScreen.MainScreen.Bounds);
|
||||
|
||||
var controller = new CustomViewController();
|
||||
|
||||
window.RootViewController = controller;
|
||||
|
||||
// make the window visible
|
||||
window.MakeKeyAndVisible();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using UIKit;
|
||||
|
||||
namespace CodeOnlyDemo
|
||||
{
|
||||
class CircleController : UIViewController
|
||||
{
|
||||
CircleView view;
|
||||
|
||||
public override void LoadView()
|
||||
{
|
||||
view = new CircleView();
|
||||
View = view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using UIKit;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace CodeOnlyDemo
|
||||
{
|
||||
class CircleView : UIView
|
||||
{
|
||||
public override void Draw(CGRect rect)
|
||||
{
|
||||
base.Draw(rect);
|
||||
|
||||
//get graphics context
|
||||
using (var g = UIGraphics.GetCurrentContext())
|
||||
{
|
||||
// set up drawing attributes
|
||||
g.SetLineWidth(10.0f);
|
||||
UIColor.Green.SetFill();
|
||||
UIColor.Blue.SetStroke();
|
||||
|
||||
// create geometry
|
||||
var path = new CGPath();
|
||||
path.AddArc(Bounds.GetMidX(), Bounds.GetMidY(), 50f, 0, 2.0f * (float)Math.PI, true);
|
||||
|
||||
// add geometry to graphics context and draw
|
||||
g.AddPath(path);
|
||||
g.DrawPath(CGPathDrawingMode.FillStroke);
|
||||
}
|
||||
}
|
||||
|
||||
public CircleView()
|
||||
{
|
||||
BackgroundColor = UIColor.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
<?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>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{DB8B7EBC-51F2-4581-8F85-A930D67C2A1D}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>CodeOnlyDemo</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>CodeOnlyProject</AssemblyName>
|
||||
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
|
||||
<TargetFrameworkVersion>v1.0</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>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</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>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<BuildIpa>true</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="CustomViewController.cs" />
|
||||
<Compile Include="CircleView.cs" />
|
||||
<Compile Include="CircleController.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\Default-568h%402x.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using UIKit;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace CodeOnlyDemo
|
||||
{
|
||||
|
||||
public class CustomViewController : UIViewController
|
||||
{
|
||||
UITextField usernameField, passwordField;
|
||||
CircleController circleController;
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
View.BackgroundColor = UIColor.Gray;
|
||||
|
||||
nfloat h = 31.0f;
|
||||
nfloat w = View.Bounds.Width;
|
||||
|
||||
usernameField = new UITextField
|
||||
{
|
||||
Placeholder = "Enter your username",
|
||||
BorderStyle = UITextBorderStyle.RoundedRect,
|
||||
Frame = new CGRect(10, 32, w - 20, h),
|
||||
AutoresizingMask = UIViewAutoresizing.FlexibleWidth
|
||||
};
|
||||
|
||||
passwordField = new UITextField
|
||||
{
|
||||
Placeholder = "Enter your password",
|
||||
BorderStyle = UITextBorderStyle.RoundedRect,
|
||||
Frame = new CGRect(10, 64, w - 20, h),
|
||||
SecureTextEntry = true,
|
||||
AutoresizingMask = UIViewAutoresizing.FlexibleWidth
|
||||
};
|
||||
|
||||
var submitButton = UIButton.FromType(UIButtonType.RoundedRect);
|
||||
submitButton.Frame = new CGRect(10, 120, w - 20, 44);
|
||||
submitButton.SetTitle("Submit", UIControlState.Normal);
|
||||
submitButton.BackgroundColor = UIColor.White;
|
||||
submitButton.Layer.CornerRadius = 5f;
|
||||
submitButton.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
|
||||
|
||||
submitButton.TouchUpInside += delegate
|
||||
{
|
||||
Console.WriteLine("Submit button pressed");
|
||||
circleController = new CircleController();
|
||||
PresentViewController(circleController, true, null);
|
||||
};
|
||||
|
||||
View.AddSubviews(new UIView[]{ usernameField, passwordField, submitButton });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?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>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>CodeOnlyProject</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.your-company.CodeOnlyProject</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.3</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace CodeOnlyProject
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 61 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SampleMetadata>
|
||||
<ID>C8C9307F-8006-4F85-9198-8D3FB1BA19A5</ID>
|
||||
<IsFullApplication>false</IsFullApplication>
|
||||
<Level>Beginning</Level>
|
||||
<Tags>Getting Started, User Interface</Tags>
|
||||
<Gallery>false</Gallery>
|
||||
<Brief>This introductory sample looks at setting up a basic iOS application in Visual Studio.</Brief>
|
||||
</SampleMetadata>
|
|
@ -0,0 +1,8 @@
|
|||
SimpleLogin
|
||||
==========
|
||||
|
||||
This sample is the application that will be built at the end of the [Creating iOS Applications in Code Using Visual Studio](http://developer.xamarin.com/guides/ios/application_fundamentals/ios_code_only/) guide.
|
||||
|
||||
|
||||
|
||||
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 94 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 96 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 31 KiB |
Загрузка…
Ссылка в новой задаче