added new `AdaptiveElements ` sample (#353)
|
@ -0,0 +1,23 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdaptiveElements", "AdaptiveElements\AdaptiveElements.csproj", "{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,143 @@
|
|||
<?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>
|
||||
<ProjectGuid>{4ADED926-6A31-4BCB-B5FF-47B36C0ADB20}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>AdaptiveElements</RootNamespace>
|
||||
<AssemblyName>AdaptiveElements</AssemblyName>
|
||||
<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;ENABLE_TEST_CLOUD;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<IOSDebuggerPort>56459</IOSDebuggerPort>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseLlvm>true</MtouchUseLlvm>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<IOSDebuggerPort>59406</IOSDebuggerPort>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\app-store-logo.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76%402x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-app-83.5%402x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%402x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29%402x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-60%402x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-app-60%403x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29%403x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%403x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\first.imageset\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\first.imageset\first.pdf" />
|
||||
<ImageAsset Include="Assets.xcassets\second.imageset\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\second.imageset\second.pdf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
<Folder Include="Assets.xcassets\first.imageset\" />
|
||||
<Folder Include="Assets.xcassets\second.imageset\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SimpleExampleViewController.designer.cs">
|
||||
<DependentUpon>SimpleExampleViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ExampleContainerViewController.designer.cs">
|
||||
<DependentUpon>ExampleContainerViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="Design.cs" />
|
||||
<Compile Include="ExampleContainerViewController.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="SimpleExampleViewController.cs" />
|
||||
<Compile Include="SmallElementViewController.cs" />
|
||||
<Compile Include="SmallElementViewController.designer.cs">
|
||||
<DependentUpon>SmallElementViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LargeElementViewController.cs" />
|
||||
<Compile Include="LargeElementViewController.designer.cs">
|
||||
<DependentUpon>LargeElementViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
<InterfaceDefinition Include="Main.storyboard" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,23 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window { get; set; }
|
||||
|
||||
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
|
||||
{
|
||||
// Override point for customization after application launch.
|
||||
// If not required for your application you can safely delete this method
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"size": "20x20",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"size": "20x20",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-29@2x.png",
|
||||
"size": "29x29",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-29@3x.png",
|
||||
"size": "29x29",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-40@2x.png",
|
||||
"size": "40x40",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-40@3x.png",
|
||||
"size": "40x40",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon-app-60@2x.png",
|
||||
"size": "60x60",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-app-60@3x.png",
|
||||
"size": "60x60",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"size": "20x20",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "20x20",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-29.png",
|
||||
"size": "29x29",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-29@2x.png",
|
||||
"size": "29x29",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-40.png",
|
||||
"size": "40x40",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon-spotlight-40@2x.png",
|
||||
"size": "40x40",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-app-83.5@2x.png",
|
||||
"size": "83.5x83.5",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon-app-76.png",
|
||||
"size": "76x76",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon-app-76@2x.png",
|
||||
"size": "76x76",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "app-store-logo.png",
|
||||
"size": "1024x1024",
|
||||
"scale": "1x",
|
||||
"idiom": "ios-marketing"
|
||||
},
|
||||
{
|
||||
"size": "60x60",
|
||||
"scale": "2x",
|
||||
"idiom": "car"
|
||||
},
|
||||
{
|
||||
"size": "60x60",
|
||||
"scale": "3x",
|
||||
"idiom": "car"
|
||||
},
|
||||
{
|
||||
"role": "notificationCenter",
|
||||
"size": "24x24",
|
||||
"subtype": "38mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "notificationCenter",
|
||||
"size": "27.5x27.5",
|
||||
"subtype": "42mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "companionSettings",
|
||||
"size": "29x29",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "companionSettings",
|
||||
"size": "29x29",
|
||||
"scale": "3x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "appLauncher",
|
||||
"size": "40x40",
|
||||
"subtype": "38mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "appLauncher",
|
||||
"size": "44x44",
|
||||
"subtype": "40mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "appLauncher",
|
||||
"size": "50x50",
|
||||
"subtype": "44mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "quickLook",
|
||||
"size": "86x86",
|
||||
"subtype": "38mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "quickLook",
|
||||
"size": "98x98",
|
||||
"subtype": "42mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "quickLook",
|
||||
"size": "108x108",
|
||||
"subtype": "44mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"size": "1024x1024",
|
||||
"scale": "1x",
|
||||
"idiom": "watch-marketing"
|
||||
},
|
||||
{
|
||||
"size": "16x16",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "16x16",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "32x32",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "32x32",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "128x128",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "128x128",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "256x256",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "256x256",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "512x512",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "512x512",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/Icon-app-60@3x.png
Normal file
После Ширина: | Высота: | Размер: 5.0 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/Icon-app-83.5@2x.png
Normal file
После Ширина: | Высота: | Размер: 8.6 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/app-store-logo.png
Normal file
После Ширина: | Высота: | Размер: 22 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-app-60@2x.png
Normal file
После Ширина: | Высота: | Размер: 3.3 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-app-76.png
Normal file
После Ширина: | Высота: | Размер: 2.0 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-app-76@2x.png
Normal file
После Ширина: | Высота: | Размер: 4.3 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-spotlight-29.png
Normal file
После Ширина: | Высота: | Размер: 900 B |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-spotlight-29@2x.png
Normal file
После Ширина: | Высота: | Размер: 1.8 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-spotlight-29@3x.png
Normal file
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-spotlight-40.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-spotlight-40@2x.png
Normal file
После Ширина: | Высота: | Размер: 2.2 KiB |
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/AppIcon.appiconset/icon-spotlight-40@3x.png
Normal file
После Ширина: | Высота: | Размер: 3.3 KiB |
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
95
AdaptiveElements/AdaptiveElements/Assets.xcassets/first.imageset/Contents.json
поставляемый
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"filename": "first.pdf",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"filename": "first.pdf",
|
||||
"scale": "1x",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"subtype": "retina4",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"screenWidth": "{130,145}",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"screenWidth": "{146,165}",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"idiom": "car"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "car"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"idiom": "car"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/first.imageset/first.pdf
поставляемый
Normal file
94
AdaptiveElements/AdaptiveElements/Assets.xcassets/second.imageset/Contents.json
поставляемый
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"filename": "second.pdf",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"idiom": "universal"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"subtype": "retina4",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"screenWidth": "{130,145}",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"screenWidth": "{146,165}",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"idiom": "car"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"idiom": "car"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"idiom": "car"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
Двоичные данные
AdaptiveElements/AdaptiveElements/Assets.xcassets/second.imageset/second.pdf
поставляемый
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
/// <summary>
|
||||
/// The ExampleContainerViewController can look and act differently depending on its size.
|
||||
/// We call each way of acting differently a "design".
|
||||
/// Design is a struct that encapsulates everything that distinguishes one design from another.
|
||||
/// Its definition is specific to this particular sample app, but you may want to use the same concept in your own apps.
|
||||
/// </summary>
|
||||
public class Design
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether to be horizontal or vertical
|
||||
/// </summary>
|
||||
public UILayoutConstraintAxis Axis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the elements inside are small or large
|
||||
/// </summary>
|
||||
public ElementKind Kind { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// We also implement a computed read-only property, which returns the identifier
|
||||
/// of the view controller in the storyboard that this design should use.
|
||||
/// </summary>
|
||||
public string ElementIdentifier
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (this.Kind)
|
||||
{
|
||||
case ElementKind.Small: return "smallElement";
|
||||
case ElementKind.Large: return "largeElement";
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ElementKind
|
||||
{
|
||||
Small,
|
||||
Large
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,150 @@
|
|||
using CoreGraphics;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
/// <summary>
|
||||
/// ExampleContainerViewController is the core of this sample code project.
|
||||
/// It demonstrates:
|
||||
/// - How to decide which design to use depending on the view's size
|
||||
/// - How to apply the design to the UI
|
||||
/// - How to correctly add and remove child view controllers
|
||||
/// </summary>
|
||||
public partial class ExampleContainerViewController : UIViewController
|
||||
{
|
||||
/// <summary>
|
||||
/// It holds our 3 child view controllers.
|
||||
/// They will either be instances of SmallElementViewController or LargeElementViewController.
|
||||
/// </summary>
|
||||
private readonly UIViewController[] elementViewControllers = { null, null, null };
|
||||
|
||||
/// <summary>
|
||||
/// It is the design that is currently displayed in the view controller.
|
||||
/// It is initially nil because no design has been displayed yet.
|
||||
/// </summary>
|
||||
private Design displayedDesign;
|
||||
|
||||
public ExampleContainerViewController(IntPtr handle) : base(handle) { }
|
||||
|
||||
public override void ViewWillLayoutSubviews()
|
||||
{
|
||||
/*
|
||||
* In viewWillLayoutSubviews, we are guaranteed that our view's size, traits, etc. are up to date.
|
||||
* It's a good place to update anything that affects the layout of our subviews.
|
||||
* However, be careful, because this method is called frequently!
|
||||
* Do as little work as possible, and don't invalidate the layout of any superviews.
|
||||
*/
|
||||
|
||||
// Step 1: Find our size.
|
||||
var size = base.View.Bounds.Size;
|
||||
|
||||
// Step 2: Decide what design to use, based on our rules.
|
||||
var newDesign = this.DecideDesign(size);
|
||||
|
||||
// Step 3: If the design is different than what is displayed, change the UI.
|
||||
if (displayedDesign != newDesign)
|
||||
{
|
||||
this.ApplyDesign(newDesign);
|
||||
this.displayedDesign = newDesign;
|
||||
}
|
||||
}
|
||||
|
||||
private Design DecideDesign(CGSize size)
|
||||
{
|
||||
/*
|
||||
* Decide which Design is appropriate, given the size of our view, by applying rules.
|
||||
*
|
||||
* Note that these rules are _examples_, which produce good results in this particular sample app,
|
||||
* but they are not general rules that would automatically work in other apps.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Decision #1: Should our elements be laid out horizontally or vertically?
|
||||
* Rule: If the width is greater that the height, be horizontal, otherwise be vertical.
|
||||
*/
|
||||
|
||||
var axis = size.Width > size.Height ? UILayoutConstraintAxis.Horizontal : UILayoutConstraintAxis.Vertical;
|
||||
|
||||
/*
|
||||
* Decision #2: Should our elements be small or large?
|
||||
* Rule: If the width is less than a threshold value, be small, otherwise be large.
|
||||
* (We chose 750 as a threshold value since it produces reasonable results for this example, but there is nothing special about that number.)
|
||||
*/
|
||||
|
||||
const float widthThreshold = 750f;
|
||||
var elementKind = size.Width < widthThreshold ? Design.ElementKind.Small : Design.ElementKind.Large;
|
||||
|
||||
// Return a Design encapsulating the results of those decisions.
|
||||
return new Design { Axis = axis, Kind = elementKind };
|
||||
}
|
||||
|
||||
private void ApplyDesign(Design newDesign)
|
||||
{
|
||||
/*
|
||||
* Change the view controllers and views to display the new design.
|
||||
* Be careful to only change properties that need to be changed.
|
||||
*/
|
||||
|
||||
// Set the stack view's layout axis to horizontal or vertical.
|
||||
if (this.displayedDesign?.Axis != newDesign.Axis)
|
||||
{
|
||||
this.stackView.Axis = newDesign.Axis;
|
||||
}
|
||||
|
||||
// Change the view controllers to the small or large kind.
|
||||
if (this.displayedDesign?.Kind != newDesign.Kind)
|
||||
{
|
||||
// Repeat these steps for each of the element view controllers:
|
||||
for (int i = 0; i < this.elementViewControllers.Length; i++)
|
||||
{
|
||||
var oldElementViewController = this.elementViewControllers[i];
|
||||
|
||||
// If an old view controller exists, then remove it from this container's child view controllers.
|
||||
if (oldElementViewController != null)
|
||||
{
|
||||
this.RemoveOldElementViewController(oldElementViewController);
|
||||
}
|
||||
|
||||
// Create the new view controller.
|
||||
var storyboard = UIStoryboard.FromName("Main", null);
|
||||
var newElementViewController = storyboard.InstantiateViewController(newDesign.ElementIdentifier);
|
||||
|
||||
// Add it as a child view controller of this container.
|
||||
this.AddNewElementViewController(newElementViewController);
|
||||
|
||||
// And remember it, so we can remove it later.
|
||||
this.elementViewControllers[i] = newElementViewController;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper functions to be a well-behaved container view controller: */
|
||||
|
||||
private void AddNewElementViewController(UIViewController elementViewController)
|
||||
{
|
||||
// Step 1: Add this view controller to our list of child view controllers.
|
||||
// This will call elementViewController.willMove(toParentViewController: self).
|
||||
base.AddChildViewController(elementViewController);
|
||||
|
||||
// Step 2: Add the view controller's view to our view hierarchy.
|
||||
this.stackView.AddArrangedSubview(elementViewController.View);
|
||||
|
||||
// Step 3: Tell the view controller that it has moved, and `self` is the new parent.
|
||||
elementViewController.DidMoveToParentViewController(this);
|
||||
}
|
||||
|
||||
private void RemoveOldElementViewController(UIViewController elementViewController)
|
||||
{
|
||||
// Step 1: Tell the view controller that it will move to having no parent view controller.
|
||||
elementViewController.WillMoveToParentViewController(null);
|
||||
|
||||
// Step 2: Remove the view controller's view from our view hierarchy.
|
||||
elementViewController.View.RemoveFromSuperview();
|
||||
|
||||
// Step 3: Remove the view controller from our list of child view controllers.
|
||||
// This will call elementViewController.didMove(toParentViewController: nil).
|
||||
elementViewController.RemoveFromParentViewController();
|
||||
}
|
||||
}
|
||||
}
|
29
AdaptiveElements/AdaptiveElements/ExampleContainerViewController.designer.cs
сгенерированный
Normal file
|
@ -0,0 +1,29 @@
|
|||
// WARNING
|
||||
//
|
||||
// This file has been generated automatically by Visual Studio from the outlets and
|
||||
// actions declared in your storyboard file.
|
||||
// Manual changes to this file will not be maintained.
|
||||
//
|
||||
using Foundation;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
[Register ("ExampleContainerViewController")]
|
||||
partial class ExampleContainerViewController
|
||||
{
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UIStackView stackView { get; set; }
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
if (stackView != null) {
|
||||
stackView.Dispose ();
|
||||
stackView = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?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>CFBundleName</key>
|
||||
<string>Adaptive Elements</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.adaptive-elements</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
/// <summary>
|
||||
/// LargeElementViewController is used in two different ways:
|
||||
/// 1. Contained within ExampleContainerViewController, when its width is large.
|
||||
/// 2. Presented by SmallElementViewController, when the ExampleContainerViewController's width is small.
|
||||
/// It shows a large version of the element.When it is presented, tapping on it will dismiss it.
|
||||
/// </summary>
|
||||
public partial class LargeElementViewController : UIViewController
|
||||
{
|
||||
private NSLayoutConstraint widthConstraint;
|
||||
|
||||
public LargeElementViewController(IntPtr handle) : base(handle) { }
|
||||
|
||||
public override void UpdateViewConstraints()
|
||||
{
|
||||
base.UpdateViewConstraints();
|
||||
|
||||
/*
|
||||
* If we are not being presented full-screen,
|
||||
* then add a constraint to make this view no wider than our superview's readable content guide.
|
||||
*/
|
||||
|
||||
if (base.PresentingViewController == null &&
|
||||
this.widthConstraint == null &&
|
||||
base.View.Superview != null)
|
||||
{
|
||||
this.widthConstraint = base.View.WidthAnchor.ConstraintLessThanOrEqualTo(base.View.Superview.ReadableContentGuide.WidthAnchor);
|
||||
if (this.widthConstraint != null)
|
||||
{
|
||||
this.widthConstraint.Active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
base.ViewWillAppear(animated);
|
||||
|
||||
/*
|
||||
* When this view appears, if we are being presented,
|
||||
* add a tap gesture recognizer so we can dismiss when we are tapped.
|
||||
*/
|
||||
|
||||
if (this.IsBeingPresented)
|
||||
{
|
||||
var tapGestureRecognizer = new UITapGestureRecognizer(this.Tapped);
|
||||
base.View.AddGestureRecognizer(tapGestureRecognizer);
|
||||
}
|
||||
}
|
||||
|
||||
private void Tapped(UITapGestureRecognizer gestureRecognizer)
|
||||
{
|
||||
if (gestureRecognizer.State == UIGestureRecognizerState.Ended)
|
||||
{
|
||||
DismissViewController(true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
AdaptiveElements/AdaptiveElements/LargeElementViewController.designer.cs
сгенерированный
Normal file
|
@ -0,0 +1,20 @@
|
|||
// WARNING
|
||||
//
|
||||
// This file has been generated automatically by Visual Studio to store outlets and
|
||||
// actions made in the UI designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
//
|
||||
using Foundation;
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
[Register ("LargeElementViewController")]
|
||||
partial class LargeElementViewController
|
||||
{
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Xamarin" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pgq-6S-Feo">
|
||||
<rect key="frame" x="116.5" y="319.5" width="142" height="48"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="40"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="pgq-6S-Feo" firstAttribute="centerY" secondItem="aDl-rP-OiZ" secondAttribute="centerY" id="kvK-tN-tdq"/>
|
||||
<constraint firstItem="pgq-6S-Feo" firstAttribute="centerX" secondItem="aDl-rP-OiZ" secondAttribute="centerX" id="x7M-70-UdS"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="aDl-rP-OiZ"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
|
@ -0,0 +1,15 @@
|
|||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="d9R-WV-I6l">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Container-->
|
||||
<scene sceneID="TGP-Jo-QLd">
|
||||
<objects>
|
||||
<viewController id="DRE-Lq-4ad" customClass="ExampleContainerViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="WiS-gd-ceC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="center" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="5yg-1f-8Qi">
|
||||
<rect key="frame" x="16" y="40" width="343" height="558"/>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.14010506868362427" green="0.24763122200965881" blue="0.37997061014175415" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="5yg-1f-8Qi" firstAttribute="top" secondItem="1Pp-9h-6BX" secondAttribute="top" constant="20" id="HBH-ic-EJF"/>
|
||||
<constraint firstItem="1Pp-9h-6BX" firstAttribute="trailing" secondItem="5yg-1f-8Qi" secondAttribute="trailing" constant="16" id="Wyb-nD-MQW"/>
|
||||
<constraint firstItem="1Pp-9h-6BX" firstAttribute="bottom" secondItem="5yg-1f-8Qi" secondAttribute="bottom" constant="20" id="bV8-mA-4ii"/>
|
||||
<constraint firstItem="5yg-1f-8Qi" firstAttribute="leading" secondItem="1Pp-9h-6BX" secondAttribute="leading" constant="16" id="okB-Nk-DhU"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="1Pp-9h-6BX"/>
|
||||
</view>
|
||||
<tabBarItem key="tabBarItem" title="Container" image="second" id="nMY-KH-lTn"/>
|
||||
<connections>
|
||||
<outlet property="stackView" destination="5yg-1f-8Qi" id="name-outlet-5yg-1f-8Qi"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6wz-aP-ZuJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="844" y="308"/>
|
||||
</scene>
|
||||
<!--Small Element View Controller-->
|
||||
<scene sceneID="wmA-ch-7aP">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="smallElement" id="tXj-0b-SBf" customClass="SmallElementViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Q3e-Vs-bTw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="150"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Element" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="saD-rk-G49">
|
||||
<rect key="frame" x="20" y="20" width="110" height="24"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.25854718685150146" green="0.479511559009552" blue="0.75461411476135254" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="saD-rk-G49" firstAttribute="top" secondItem="4BM-l1-QMB" secondAttribute="top" constant="20" id="5EM-1H-V4d"/>
|
||||
<constraint firstItem="saD-rk-G49" firstAttribute="leading" secondItem="4BM-l1-QMB" secondAttribute="leading" constant="20" id="Xdu-up-UJF"/>
|
||||
<constraint firstItem="4BM-l1-QMB" firstAttribute="trailing" secondItem="saD-rk-G49" secondAttribute="trailing" constant="20" id="th3-Ur-Kh7"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="4BM-l1-QMB"/>
|
||||
</view>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<size key="freeformSize" width="150" height="150"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="IFc-ff-YUP" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1527" y="5"/>
|
||||
</scene>
|
||||
<!--Large Element View Controller-->
|
||||
<scene sceneID="Q6I-e3-wyH">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="largeElement" id="XlI-Es-tcn" customClass="LargeElementViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="OAA-YT-hj7">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="400"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Element" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jkU-Pf-7kO">
|
||||
<rect key="frame" x="20" y="20" width="360" height="32"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rio-v2-OSh">
|
||||
<rect key="frame" x="20" y="60" width="360" height="264"/>
|
||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.25854718685150146" green="0.479511559009552" blue="0.75461411476135254" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Rio-v2-OSh" firstAttribute="leading" secondItem="saW-1L-YF4" secondAttribute="leading" constant="20" id="CZY-rH-ts3"/>
|
||||
<constraint firstItem="Rio-v2-OSh" firstAttribute="top" secondItem="jkU-Pf-7kO" secondAttribute="bottom" constant="8" id="J47-Vh-i4R"/>
|
||||
<constraint firstItem="jkU-Pf-7kO" firstAttribute="top" secondItem="saW-1L-YF4" secondAttribute="top" constant="20" id="LLg-hE-Lk1"/>
|
||||
<constraint firstItem="saW-1L-YF4" firstAttribute="trailing" secondItem="jkU-Pf-7kO" secondAttribute="trailing" constant="20" id="Nq2-iJ-VnY"/>
|
||||
<constraint firstItem="saW-1L-YF4" firstAttribute="trailing" secondItem="Rio-v2-OSh" secondAttribute="trailing" constant="20" id="PEc-QC-9H0"/>
|
||||
<constraint firstItem="saW-1L-YF4" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Rio-v2-OSh" secondAttribute="bottom" constant="20" id="sEy-n1-rs9"/>
|
||||
<constraint firstItem="jkU-Pf-7kO" firstAttribute="leading" secondItem="saW-1L-YF4" secondAttribute="leading" constant="20" id="uRz-fh-J48"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="saW-1L-YF4"/>
|
||||
</view>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<size key="freeformSize" width="400" height="400"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="3k5-cx-cfP" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1726" y="354"/>
|
||||
</scene>
|
||||
<!--Simple-->
|
||||
<scene sceneID="odh-ER-FeY">
|
||||
<objects>
|
||||
<viewController id="cRl-AM-Qja" customClass="SimpleExampleViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="ywv-WB-SSi">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="I2a-8H-OFc">
|
||||
<rect key="frame" x="112.5" y="74" width="150" height="490"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sUH-99-pbY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="150"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="A" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2af-BO-nav">
|
||||
<rect key="frame" x="20" y="20" width="110" height="24"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.2585471869" green="0.47951155899999998" blue="0.75461411479999996" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="150" id="8A1-3V-aWP"/>
|
||||
<constraint firstItem="2af-BO-nav" firstAttribute="top" secondItem="sUH-99-pbY" secondAttribute="top" constant="20" id="8FF-Yt-3xP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="2af-BO-nav" secondAttribute="trailing" constant="20" id="9kP-Hq-QTZ"/>
|
||||
<constraint firstAttribute="width" constant="150" id="Es8-F1-pD3"/>
|
||||
<constraint firstItem="2af-BO-nav" firstAttribute="leading" secondItem="sUH-99-pbY" secondAttribute="leading" constant="20" id="JcP-Zd-liv"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="abE-Tj-vab">
|
||||
<rect key="frame" x="0.0" y="170" width="150" height="150"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="B" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bbU-SC-R9J">
|
||||
<rect key="frame" x="20" y="20" width="110" height="24"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.25854718685150146" green="0.479511559009552" blue="0.75461411476135254" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="bbU-SC-R9J" firstAttribute="top" secondItem="abE-Tj-vab" secondAttribute="top" constant="20" id="7us-t6-rbD"/>
|
||||
<constraint firstAttribute="height" constant="150" id="MNC-Zl-wUp"/>
|
||||
<constraint firstAttribute="width" constant="150" id="Si5-KC-G3Y"/>
|
||||
<constraint firstAttribute="trailing" secondItem="bbU-SC-R9J" secondAttribute="trailing" constant="20" id="Uj5-ht-Pbj"/>
|
||||
<constraint firstItem="bbU-SC-R9J" firstAttribute="leading" secondItem="abE-Tj-vab" secondAttribute="leading" constant="20" id="XrM-TT-qmX"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qSf-z8-6gL">
|
||||
<rect key="frame" x="0.0" y="340" width="150" height="150"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="C" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7nf-vn-oab">
|
||||
<rect key="frame" x="20" y="20" width="110" height="24"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.2585471869" green="0.47951155899999998" blue="0.75461411479999996" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="7nf-vn-oab" firstAttribute="leading" secondItem="qSf-z8-6gL" secondAttribute="leading" constant="20" id="Wpi-3A-1kH"/>
|
||||
<constraint firstAttribute="height" constant="150" id="grf-4m-7nD"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7nf-vn-oab" secondAttribute="trailing" constant="20" id="tp9-NF-up2"/>
|
||||
<constraint firstItem="7nf-vn-oab" firstAttribute="top" secondItem="qSf-z8-6gL" secondAttribute="top" constant="20" id="xF7-Ya-aVJ"/>
|
||||
<constraint firstAttribute="width" constant="150" id="yE3-in-HKb"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.14010506868362427" green="0.24763122200965881" blue="0.37997061014175415" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="I2a-8H-OFc" firstAttribute="centerX" secondItem="GYl-2e-v2G" secondAttribute="centerX" id="A54-ge-ep5"/>
|
||||
<constraint firstItem="I2a-8H-OFc" firstAttribute="centerY" secondItem="GYl-2e-v2G" secondAttribute="centerY" id="fLC-2h-GcA"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="GYl-2e-v2G"/>
|
||||
</view>
|
||||
<tabBarItem key="tabBarItem" title="Simple" image="first" id="mT9-hj-hPf"/>
|
||||
<connections>
|
||||
<outlet property="stackView" destination="I2a-8H-OFc" id="name-outlet-I2a-8H-OFc"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="axI-qF-Ojp" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="844" y="-357"/>
|
||||
</scene>
|
||||
<!--Tab Bar Controller-->
|
||||
<scene sceneID="EdT-em-xAw">
|
||||
<objects>
|
||||
<tabBarController id="d9R-WV-I6l" sceneMemberID="viewController">
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<nil key="simulatedBottomBarMetrics"/>
|
||||
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Uma-IF-qCt">
|
||||
<rect key="frame" x="0.0" y="617" width="375" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tabBar>
|
||||
<connections>
|
||||
<segue destination="cRl-AM-Qja" kind="relationship" relationship="viewControllers" id="EyD-aq-M0W"/>
|
||||
<segue destination="DRE-Lq-4ad" kind="relationship" relationship="viewControllers" id="WdZ-me-1H0"/>
|
||||
</connections>
|
||||
</tabBarController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Q8V-aA-wP9" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-108" y="-25"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="first" width="30" height="30"/>
|
||||
<image name="second" width="30" height="30"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -0,0 +1,67 @@
|
|||
using CoreGraphics;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
/// <summary>
|
||||
/// SimpleExampleViewController demonstrates how to use a view's size to determine an arrangement of its subviews.
|
||||
/// Also, it shows how to add an animation effect during app size changes.
|
||||
/// </summary>
|
||||
public partial class SimpleExampleViewController : UIViewController
|
||||
{
|
||||
public SimpleExampleViewController(IntPtr handle) : base(handle) { }
|
||||
|
||||
public override void ViewWillLayoutSubviews()
|
||||
{
|
||||
/*
|
||||
* In viewWillLayoutSubviews, we are guaranteed that our view's size, traits, etc. are up to date.
|
||||
* It's a good place to update anything that affects the layout of our subviews.
|
||||
* However, be careful, because this method is called frequently!
|
||||
* Do as little work as possible, and don't invalidate the layout of any superviews.
|
||||
*/
|
||||
|
||||
// Step 1: Find our size.
|
||||
var size = base.View.Bounds.Size;
|
||||
|
||||
// Step 2: Decide what design to use, based on our rules.
|
||||
var useWideDesign = size.Width > size.Height;
|
||||
|
||||
// Step 3: Apply the design to the UI.
|
||||
this.stackView.Axis = useWideDesign ? UILayoutConstraintAxis.Horizontal : UILayoutConstraintAxis.Vertical;
|
||||
}
|
||||
|
||||
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
|
||||
{
|
||||
/*
|
||||
* We override viewWillTransition(to size: with coordinator:) in order to add special behavior
|
||||
* when the app changes size, especially when the device is rotated.
|
||||
* In this demo app, we add an effect to make the items "pop" towards the viewer during the rotation,
|
||||
* and then go back to normal afterwards.
|
||||
*/
|
||||
|
||||
base.ViewWillTransitionToSize(toSize, coordinator);
|
||||
|
||||
// If self.stackView is null, then our view has not yet been loaded, and there is nothing to do.
|
||||
if (this.stackView != null)
|
||||
{
|
||||
// Add alongside and completion animations.
|
||||
coordinator.AnimateAlongsideTransition((_) =>
|
||||
{
|
||||
/*
|
||||
* Scale the stackView to be larger than normal.
|
||||
* This animates along with the rest of the rotation animation.
|
||||
*/
|
||||
this.stackView.Transform = CGAffineTransform.MakeScale(1.4f, 1.4f);
|
||||
}, (_) =>
|
||||
{
|
||||
/*
|
||||
* The rotation animation is complete. Add an additional 0.5 second
|
||||
* animation to set the scale back to normal.
|
||||
*/
|
||||
UIView.Animate(0.5f, () => this.stackView.Transform = CGAffineTransform.MakeIdentity());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
AdaptiveElements/AdaptiveElements/SimpleExampleViewController.designer.cs
сгенерированный
Normal file
|
@ -0,0 +1,28 @@
|
|||
// WARNING
|
||||
//
|
||||
// This file has been generated automatically by Visual Studio from the outlets and
|
||||
// actions declared in your storyboard file.
|
||||
// Manual changes to this file will not be maintained.
|
||||
//
|
||||
using Foundation;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
[Register ("SimpleExampleViewController")]
|
||||
partial class SimpleExampleViewController
|
||||
{
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UIStackView stackView { get; set; }
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
if (stackView != null) {
|
||||
stackView.Dispose ();
|
||||
stackView = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
/// <summary>
|
||||
/// SmallElementViewController is contained within ExampleContainerViewController.
|
||||
/// It shows a small version of the element.Tapping on it presents a LargeElementViewController which shows more details.
|
||||
/// </summary>
|
||||
public partial class SmallElementViewController : UIViewController
|
||||
{
|
||||
public SmallElementViewController(IntPtr handle) : base(handle) { }
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
/*
|
||||
* `ViewDidLoad()` is NOT the place to do everything.
|
||||
* However, it is a good place to do work that does not depend on
|
||||
* any other objects or views, and that will be the same no matter where this view controller is used.
|
||||
* In this view controller, the following code qualifies:
|
||||
*/
|
||||
|
||||
// Add a constraint to make this view always square.
|
||||
var constraint = base.View.WidthAnchor.ConstraintEqualTo(base.View.HeightAnchor);
|
||||
constraint.Active = true;
|
||||
|
||||
/*
|
||||
* The SmallElementViewController is just a preview.
|
||||
* Tap on our view to show the details in the LargeElementViewController.
|
||||
*/
|
||||
|
||||
var tapGestureRecognizer = new UITapGestureRecognizer(this.Tapped);
|
||||
base.View.AddGestureRecognizer(tapGestureRecognizer);
|
||||
}
|
||||
|
||||
private void Tapped(UITapGestureRecognizer gestureRecognizer)
|
||||
{
|
||||
if (gestureRecognizer.State == UIGestureRecognizerState.Ended)
|
||||
{
|
||||
// Create the larger view controller:
|
||||
var storyboard = UIStoryboard.FromName("Main", null);
|
||||
var newElementViewController = storyboard.InstantiateViewController("largeElement");
|
||||
|
||||
/*
|
||||
* And present it.
|
||||
* We use the `.overFullScreen` presentation style so the ExampleContainerViewController
|
||||
* underneath will go through the normal layout process, even while the presentation is active.
|
||||
*/
|
||||
|
||||
newElementViewController.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen;
|
||||
base.PresentViewController(newElementViewController, true, null);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WillMoveToParentViewController(UIViewController parent)
|
||||
{
|
||||
/*
|
||||
* When we are removed from our parent view controller
|
||||
* (which could happen when the parent changes to a different Design),
|
||||
* if we presented the ElementViewController, then dismiss it.
|
||||
*/
|
||||
if (parent == null && base.PresentedViewController != null)
|
||||
{
|
||||
this.DismissViewController(false, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
AdaptiveElements/AdaptiveElements/SmallElementViewController.designer.cs
сгенерированный
Normal file
|
@ -0,0 +1,20 @@
|
|||
// WARNING
|
||||
//
|
||||
// This file has been generated automatically by Visual Studio to store outlets and
|
||||
// actions made in the UI designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
//
|
||||
using Foundation;
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace AdaptiveElements
|
||||
{
|
||||
[Register ("SmallElementViewController")]
|
||||
partial class SmallElementViewController
|
||||
{
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
Sample code project: AdaptiveElements: Implementing Your Own Adaptive Design with UIKit
|
||||
Version: 1.0
|
||||
|
||||
IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
||||
be used to endorse or promote products derived from the Apple Software
|
||||
without specific prior written permission from Apple. Except as
|
||||
expressly stated in this notice, no other rights or licenses, express or
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SampleMetadata>
|
||||
<ID>8ba2d4f2-72b6-44cc-ac57-05a8de10492b</ID>
|
||||
<IsFullApplication>false</IsFullApplication>
|
||||
<Brief>Implementing Your Own Adaptive Design with UIKit</Brief>
|
||||
<SupportedPlatforms>iOS</SupportedPlatforms>
|
||||
<Level>Intermediate</Level>
|
||||
<Tags>User Interface</Tags>
|
||||
<Gallery>true</Gallery>
|
||||
</SampleMetadata>
|
|
@ -0,0 +1,27 @@
|
|||
AdaptiveElements: Implementing Your Own Adaptive Design with UIKit
|
||||
============
|
||||
|
||||
This sample shows how to use UIKit to lay out your app's elements in different sizes, from full-screen on the smallest iPhone to Multitasking on the biggest iPad. It shows how to make smart decisions about implementing your own design. It also demonstrates how to reuse elements in different sizes, so you can take advantage of all the available space without having to rewrite your entire app.
|
||||
|
||||
![Home Screen](Screenshots/screenshot-3.png)
|
||||
![Adaptive Home Screen](Screenshots/screenshot-4.png)
|
||||
|
||||
Build Requirements
|
||||
-------
|
||||
|
||||
Xamarin.iOS 10.0+ and Xcode 8.0+.
|
||||
|
||||
Related Links
|
||||
-------
|
||||
|
||||
- [Original sample](https://developer.apple.com/library/archive/samplecode/AdaptiveElements/Introduction/Intro.html)
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Xamarin port changes are released under the MIT license.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Ported to Xamarin.iOS by Mykyta Bondarenko
|
После Ширина: | Высота: | Размер: 24 KiB |
После Ширина: | Высота: | Размер: 21 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 205 KiB |