[IntoToAppearance]Adding new sample for docs purposes

This commit is contained in:
Amy Burns 2015-06-25 15:48:27 -04:00
Родитель e0dffc5e4f
Коммит 697c06c060
20 изменённых файлов: 453 добавлений и 0 удалений

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

@ -0,0 +1,31 @@
using Foundation;
using UIKit;
namespace Appearance {
/// <summary>
/// Sizes the window according to the screen, for iPad as well as iPhone support
/// </summary>
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
UIWindow window;
UINavigationController navigationController;
AppearanceViewController v;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
v = new AppearanceViewController();
navigationController = new UINavigationController();
navigationController.PushViewController (v, false);
UINavigationBar.Appearance.TintColor = UIColor.FromRGB(0, 127, 70); // light green
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.BackgroundColor = UIColor.FromRGB(240,240,240);
window.Bounds = UIScreen.MainScreen.Bounds;
window.AddSubview(navigationController.View);
window.MakeKeyAndVisible ();
return true;
}
}
}

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

@ -0,0 +1,105 @@
<?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>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{367D4ECC-D04A-41FB-A784-4D10F30666C8}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Appearance</RootNamespace>
<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\Appearance\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>true</MtouchDebug>
<ConsolePause>false</ConsolePause>
<MtouchI18n>
</MtouchI18n>
<AssemblyName>Twitter</AssemblyName>
<MtouchSdkVersion>8.3</MtouchSdkVersion>
<MtouchLink>None</MtouchLink>
<MtouchArch>i386</MtouchArch>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Appearance\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<ConsolePause>false</ConsolePause>
<MtouchI18n>
</MtouchI18n>
<AssemblyName>Twitter</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<ConsolePause>false</ConsolePause>
<AssemblyName>Appearance</AssemblyName>
<MtouchSdkVersion>5.0</MtouchSdkVersion>
<BuildIpa>true</BuildIpa>
<IpaPackageName>
</IpaPackageName>
<MtouchI18n>
</MtouchI18n>
<MtouchLink>None</MtouchLink>
<MtouchArch>ARMv7</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<AssemblyName>FileSystem</AssemblyName>
<MtouchArch>ARMv7, ARM64</MtouchArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="AppearanceViewController.cs" />
<Compile Include="BlackViewController.cs" />
<Compile Include="BlueViewController.cs" />
<Compile Include="PlainView.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Resources\Icon-76%402x.png" />
<BundleResource Include="Resources\Icon-76.png" />
<BundleResource Include="Resources\Icon-72%402x.png" />
<BundleResource Include="Resources\Icon-72.png" />
<BundleResource Include="Resources\Icon-60%402x.png" />
<BundleResource Include="Resources\Icon%402x.png" />
<BundleResource Include="Resources\Icon.png" />
</ItemGroup>
</Project>

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

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Appearance", "Appearance.csproj", "{367D4ECC-D04A-41FB-A784-4D10F30666C8}"
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
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Debug|iPhone.ActiveCfg = Debug|iPhone
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Debug|iPhone.Build.0 = Debug|iPhone
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhone.ActiveCfg = Release|iPhone
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhone.Build.0 = Release|iPhone
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Appearance.csproj
EndGlobalSection
EndGlobal

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

@ -0,0 +1,109 @@
using System;
using CoreGraphics;
using System.Linq;
using UIKit;
using Foundation;
using CoreImage;
namespace Appearance
{
/// <summary>
/// View containing Buttons, TextView and ImageViews to show off the samples
/// </summary>
/// <remarks>
/// See the 'SampleCode.cs' file for the actual sample code
/// </remarks>
public class AppearanceViewController : UIViewController
{
UIButton btnBlack, btnBlue;
UISlider slider, slider2;
UIProgressView progress, progress2;
UILabel overrideLabel;
public AppearanceViewController () {
// Set the default appearance values
UIButton.Appearance.TintColor = UIColor.LightGray;
UIButton.Appearance.SetTitleColor(UIColor.FromRGB(0,127,14), UIControlState.Normal);
UISlider.Appearance.ThumbTintColor = UIColor.Red;
UISlider.Appearance.MinimumTrackTintColor = UIColor.Orange;
UISlider.Appearance.MaximumTrackTintColor = UIColor.Yellow;
UIProgressView.Appearance.ProgressTintColor = UIColor.Yellow;
UIProgressView.Appearance.TrackTintColor = UIColor.Orange;
btnBlack = UIButton.FromType(UIButtonType.System);
btnBlue = UIButton.FromType(UIButtonType.System);
slider = new UISlider(new CGRect(10,110,300, 30));
slider2 = new UISlider(new CGRect(10,260,300, 30));
// Wire up the buttons to the SampleCode class methods
btnBlack.TouchUpInside += (sender, e) => {
NavigationController.PushViewController (new BlackViewController(), true);
};
btnBlue.TouchUpInside += (sender, e) => {
NavigationController.PushViewController (new BlueViewController(), true);
};
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Appearance";
// Create the buttons and TextView to run the sample code
//btnBlack = UIButton.FromType(UIButtonType.RoundedRect);
btnBlack.Frame = new CGRect(10,50,145,50);
btnBlack.SetTitle("Black theme", UIControlState.Normal);
//btnBlue = UIButton.FromType(UIButtonType.RoundedRect);
btnBlue.Frame = new CGRect(165,50,145,50);
btnBlue.SetTitle("Blue theme", UIControlState.Normal);
//slider = new UISlider(new RectangleF(10,110,300, 30));
slider.Value = 0.75f;
//slider2 = new UISlider(new RectangleF(10,260,300, 30));
slider2.Value = 0.5f;
progress = new UIProgressView(new CGRect(10, 150, 300, 30));
progress.Progress = 0.35f;
progress2 = new UIProgressView(new CGRect(10, 300, 300, 30));
progress2.Progress = 0.85f;
// setting the values directly OVERRIDES the Appearance defaults
slider2.ThumbTintColor = UIColor.FromRGB (0,127,70); // dark green
slider2.MinimumTrackTintColor = UIColor.FromRGB (66,255,63);
slider2.MaximumTrackTintColor = UIColor.FromRGB (197,255,132);
progress2.ProgressTintColor = UIColor.FromRGB (66,255,63);
progress2.TrackTintColor = UIColor.FromRGB (197,255,132);
overrideLabel = new UILabel(new CGRect(10, 220, 310, 30));
overrideLabel.Text = "Overridden values are always observed";
overrideLabel.BackgroundColor = UIColor.Clear;
// Add the controls to the view
Add(btnBlack);
Add(btnBlue);
Add(slider);
Add(slider2);
Add (progress);
Add (progress2);
Add (overrideLabel);
}
}
}

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

@ -0,0 +1,44 @@
using System;
using CoreGraphics;
using System.Linq;
using UIKit;
using Foundation;
using CoreImage;
namespace Appearance {
public class BlackViewController : UIViewController {
PlainView plainView;
public BlackViewController ()
{
Title = "Black";
var style = UIButton.AppearanceWhenContainedIn(typeof(PlainView));
style.SetTitleColor(UIColor.Black, UIControlState.Normal);
var style1 = UISlider.AppearanceWhenContainedIn(typeof(PlainView));
style1.ThumbTintColor = UIColor.DarkGray;
style1.MaximumTrackTintColor = UIColor.Gray;
style1.MinimumTrackTintColor = UIColor.LightGray;
var style2 = UIProgressView.AppearanceWhenContainedIn(typeof(PlainView));
style2.ProgressTintColor = UIColor.DarkGray;
style2.TrackTintColor = UIColor.LightGray;
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
plainView = new PlainView();
plainView.Frame = View.Bounds;
View.BackgroundColor = UIColor.White;
View.AddSubview(plainView);
}
}
}

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

@ -0,0 +1,42 @@
using System;
using CoreGraphics;
using System.Linq;
using UIKit;
using Foundation;
using CoreImage;
namespace Appearance {
public class BlueViewController : UIViewController {
PlainView plainView;
public BlueViewController ()
{
Title = "Blue";
var style = UIButton.AppearanceWhenContainedIn(typeof(PlainView));
style.SetTitleColor(UIColor.Blue, UIControlState.Normal);
var style1 = UISlider.AppearanceWhenContainedIn(typeof(PlainView));
style1.ThumbTintColor = UIColor.Blue;
style1.MaximumTrackTintColor = UIColor.FromRGB(0, 114, 255);
style1.MinimumTrackTintColor = UIColor.FromRGB(0, 255, 255);
var style2 = UIProgressView.AppearanceWhenContainedIn(typeof(PlainView));
style2.ProgressTintColor = UIColor.FromRGB(150, 221, 255);
style2.TrackTintColor = UIColor.FromRGB(211, 255, 243);
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
plainView = new PlainView();
plainView.Frame = View.Bounds;
plainView.BackgroundColor = UIColor.FromRGB (201,207,255);
View.AddSubview(plainView);
}
}
}

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

@ -0,0 +1,38 @@
<?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>Appearance</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-76@2x</string>
<string>Icon-76</string>
<string>Icon-72@2x</string>
<string>Icon-72</string>
<string>Icon-60@2x</string>
<string>Icon@2x</string>
<string>Icon</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.xamarin.samples.appearance</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.3</string>
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIFileSharingEnabled</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

12
IntroToAppearance/Main.cs Normal file
Просмотреть файл

@ -0,0 +1,12 @@
using UIKit;
namespace Appearance {
/// <summary>Kick everything off</summary>
public class Application {
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
}

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

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<SampleMetadata>
<ID>F343BF84-C815-4CB9-9F7A-FCB9C3099C23</ID>
<IsFullApplication>false</IsFullApplication>
<Level>Beginning</Level>
<Tags>Graphics</Tags>
<LicenseRequirement>starter</LicenseRequirement>
<Gallery>false</Gallery>
<Brief>This contains a sample demonstrating the use of the Appearance API.</Brief>
</SampleMetadata>

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

@ -0,0 +1,32 @@
using System;
using UIKit;
using CoreGraphics;
namespace Appearance {
public class PlainView : UIView {
UIButton plainButton;
UISlider slider;
UIProgressView progress;
public PlainView ()
{
plainButton = UIButton.FromType(UIButtonType.RoundedRect);
plainButton.SetTitle ("Plain Button", UIControlState.Normal);
slider = new UISlider();
progress = new UIProgressView();
plainButton.Frame = new CGRect(20, 150, 130, 40);
slider.Frame = new CGRect(20, 190, 250, 20);
progress.Frame = new CGRect(20, 230, 250, 20);
slider.Value = 0.75f;
progress.Progress = 0.35f;
Add (plainButton);
Add (slider);
Add (progress);
}
}
}

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

@ -0,0 +1,4 @@
Introduction to Appearance
=====================
This contains a sample demonstrating the use of the Appearance API. You can find more information on this in the [Introduction to Appearance API](http://developer.xamarin.com/guides/ios/user_interface/introduction_to_the_appearance_api/) guide

Двоичные данные
IntroToAppearance/Resources/Default-568h@2x.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon-60@2x.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon-72.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon-72@2x.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon-76.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon-76@2x.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon.png Normal file

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

После

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

Двоичные данные
IntroToAppearance/Resources/Icon@2x.png Normal file

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

После

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

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

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

После

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