* added new project

* deleted old project

* added assets

* updated screenshots
This commit is contained in:
Mykyta Bondarenko 2018-12-07 06:28:00 +02:00 коммит произвёл Craig Dunn
Родитель bca7e699df
Коммит 5778e39306
59 изменённых файлов: 828 добавлений и 659 удалений

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

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

До

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

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

До

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

Двоичные данные
WorldCities/Resources/Default-Landscape~ipad.png

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

До

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

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

До

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

Двоичные данные
WorldCities/Resources/Default-Portrait~ipad.png

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

До

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

Двоичные данные
WorldCities/Resources/Default.png

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

До

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

Двоичные данные
WorldCities/Resources/Default@2x.png

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

До

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

Двоичные данные
WorldCities/Resources/iTunesArtwork.png

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

До

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

Двоичные данные
WorldCities/Resources/iTunesArtwork@2x.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-100.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-114.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-144.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-29.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-50.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-57.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-58.png

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

До

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

Двоичные данные
WorldCities/Resources/icon-72.png

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

До

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

Двоичные данные
WorldCities/Screenshots/WorldCities1.png

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

До

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

Двоичные данные
WorldCities/Screenshots/WorldCities2.png

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

До

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

Двоичные данные
WorldCities/Screenshots/WorldCities3.png

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

До

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

Двоичные данные
WorldCities/Screenshots/screenshot-1.png Normal file

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

После

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

Двоичные данные
WorldCities/Screenshots/screenshot-2.png Normal file

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

После

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

Двоичные данные
WorldCities/Screenshots/screenshot-3.png Normal file

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

После

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

Двоичные данные
WorldCities/Screenshots/screenshot-4.png Normal file

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

После

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

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

@ -1,122 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>WorldCities</RootNamespace>
<AssemblyName>WorldCities</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>
<MtouchDebug>True</MtouchDebug>
<MtouchI18n></MtouchI18n>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</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>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<IpaPackageName></IpaPackageName>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</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>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="WorldCities\WorldCitiesListController.cs" />
<Compile Include="WorldCities\WorldCitiesListController.designer.cs">
<DependentUpon>WorldCitiesListController.cs</DependentUpon>
</Compile>
<Compile Include="WorldCities\WorldCitiesViewController.cs" />
<Compile Include="WorldCities\WorldCitiesViewController.designer.cs">
<DependentUpon>WorldCitiesViewController.cs</DependentUpon>
</Compile>
<Compile Include="WorldCities\WorldCity.cs" />
<Compile Include="WorldCities\AppDelegate.cs" />
<Compile Include="WorldCities\Main.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="WorldCities\MainStoryboard.storyboard" />
</ItemGroup>
<ItemGroup>
<Content Include="CityList.plist" />
</ItemGroup>
<ItemGroup>
<Folder Include="WorldCities\" />
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Resources\Default-Landscape%402x~ipad.png" />
<BundleResource Include="Resources\Default-Landscape~ipad.png" />
<BundleResource Include="Resources\Default-Portrait%402x~ipad.png" />
<BundleResource Include="Resources\Default-Portrait~ipad.png" />
<BundleResource Include="Resources\Default.png" />
<BundleResource Include="Resources\Default%402x.png" />
<BundleResource Include="Resources\iTunesArtwork%402x.png" />
<BundleResource Include="Resources\icon-100.png" />
<BundleResource Include="Resources\icon-114.png" />
<BundleResource Include="Resources\icon-144.png" />
<BundleResource Include="Resources\icon-29.png" />
<BundleResource Include="Resources\icon-50.png" />
<BundleResource Include="Resources\icon-57.png" />
<BundleResource Include="Resources\icon-58.png" />
<BundleResource Include="Resources\icon-72.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="Resources\iTunesArtwork.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

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

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorldCities", "WorldCities.csproj", "{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorldCities", "WorldCities\WorldCities.csproj", "{F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,14 +11,14 @@ Global
Release|iPhone = Release|iPhone Release|iPhone = Release|iPhone
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Debug|iPhone.ActiveCfg = Debug|iPhone {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Debug|iPhone.Build.0 = Debug|iPhone {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Release|iPhone.ActiveCfg = Release|iPhone {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Debug|iPhone.ActiveCfg = Debug|iPhone
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Release|iPhone.Build.0 = Release|iPhone {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Debug|iPhone.Build.0 = Debug|iPhone
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Release|iPhone.ActiveCfg = Release|iPhone
{90BC50CE-3867-44A6-AAA5-259FA2D6CC7C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}.Release|iPhone.Build.0 = Release|iPhone
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = WorldCities\WorldCities.csproj StartupItem = WorldCities\WorldCities.csproj

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

@ -1,71 +1,21 @@
// using Foundation;
// AppDelegate.cs
//
// Author:
// Mike Krüger <mkrueger@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit; using UIKit;
namespace WorldCities namespace WorldCities
{ {
// The UIApplicationDelegate for the application. This class is responsible for launching the // 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 // User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
// application events from iOS.
[Register("AppDelegate")] [Register("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate public class AppDelegate : UIApplicationDelegate
{ {
// class-level declarations public override UIWindow Window { get; set; }
[Export("window")] public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
public override UIWindow Window {
get;
set;
}
// This method is invoked when the application is about to move from active to inactive state.
// OpenGL applications should use this method to pause.
public override void OnResignActivation (UIApplication application)
{ {
} // Override point for customization after application launch.
// If not required for your application you can safely delete this method
// This method should be used to release shared resources and it should store the application state. return true;
// If your application supports background exection this method is called instead of WillTerminate
// when the user quits.
public override void DidEnterBackground (UIApplication application)
{
}
/// This method is called as part of the transiton from background to active state.
public override void WillEnterForeground (UIApplication application)
{
}
/// This method is called when the application is about to terminate. Save data, if needed.
public override void WillTerminate (UIApplication application)
{
} }
} }
} }

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

@ -0,0 +1,244 @@
{
"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"
},
{
"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"
}
}

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

После

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

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
using Foundation;
using System;
using System.Collections.Generic;
using UIKit;
namespace WorldCities
{
public partial class CitiesViewController : UITableViewController
{
private const string CellIdentifier = "cellIdentifier";
private readonly List<WorldCity> cities = new List<WorldCity>();
public event EventHandler<CityEventArgs> CityChanged;
public CitiesViewController (IntPtr handle) : base (handle) { }
public override void ViewDidLoad()
{
base.ViewDidLoad();
var path = NSBundle.MainBundle.PathForResource("CityList", "plist");
var citiesArray = NSArray.FromFile(path);
foreach (var city in NSArray.FromArray<NSDictionary>(citiesArray))
{
cities.Add(new WorldCity(city[(NSString)"cityNameKey"].ToString(),
double.Parse(city[(NSString)"latitudeKey"].ToString()),
double.Parse(city[(NSString)"longitudeKey"].ToString())));
}
}
public override nint RowsInSection(UITableView tableView, nint section)
{
return cities.Count;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell(CellIdentifier);
var city = cities[indexPath.Row];
cell.TextLabel.Text = city.Name;
cell.DetailTextLabel.Text = $"{city.Latitude} {city.Longitude}";
return cell;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
CityChanged?.Invoke(this, new CityEventArgs(cities[indexPath.Row]));
DismissViewController(true, null);
}
}
}

18
WorldCities/WorldCities/CitiesViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,18 @@
// 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 WorldCities
{
[Register ("CitiesViewController")]
partial class CitiesViewController
{
}
}

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

@ -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>

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

@ -2,32 +2,39 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleIconFiles</key> <key>CFBundleName</key>
<array> <string>World Cities</string>
<string>Resources/icon-57.png</string> <key>CFBundleIdentifier</key>
<string>Resources/icon-114.png</string> <string>com.xamarin.world-cities</string>
<string>Resources/icon-72.png</string> <key>CFBundleShortVersionString</key>
<string>Resources/icon-144.png</string> <string>1.0</string>
<string>Resources/icon-29.png</string> <key>CFBundleVersion</key>
<string>Resources/icon-58.png</string> <string>1.0</string>
<string>Resources/icon-50.png</string> <key>LSRequiresIPhoneOS</key>
<string>Resources/icon-100.png</string> <true/>
</array> <key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>
<array> <array>
<integer>1</integer> <integer>1</integer>
<integer>2</integer>
</array> </array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>MainStoryboard</string> <string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>MinimumOSVersion</key> <key>XSAppIconAssets</key>
<string>9.0</string> <string>Assets.xcassets/AppIcon.appiconset</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.worldcities</string>
</dict> </dict>
</plist> </plist>

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

@ -0,0 +1,41 @@
<?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" 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="QiA-wk-IMj">
<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="QiA-wk-IMj" firstAttribute="centerY" secondItem="YOa-k8-Czw" secondAttribute="centerY" id="VES-Zm-P6j"/>
<constraint firstItem="QiA-wk-IMj" firstAttribute="centerX" secondItem="YOa-k8-Czw" secondAttribute="centerX" id="dmq-ea-xRF"/>
</constraints>
<viewLayoutGuide key="safeArea" id="YOa-k8-Czw"/>
</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>

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

@ -1,33 +1,4 @@
// using UIKit;
// Main.cs
//
// Author:
// Mike Krüger <mkrueger@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace WorldCities namespace WorldCities
{ {

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

@ -0,0 +1,116 @@
<?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="BYZ-38-t0r">
<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="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="vAR-1N-jN7">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</mapView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hGv-4F-dpM">
<rect key="frame" x="0.0" y="623" width="375" height="44"/>
<items>
<barButtonItem systemItem="bookmarks" id="TKb-TN-Uzx">
<connections>
<segue destination="pni-sa-b4n" kind="presentation" id="fRy-Pp-her"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="bb7-89-gtp"/>
<barButtonItem style="plain" id="MaJ-j4-7w1">
<segmentedControl key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="8Tr-kb-Q0H">
<rect key="frame" x="147" y="7" width="212" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="Standard"/>
<segment title="Satellite"/>
<segment title="Hybrid"/>
</segments>
<connections>
<action selector="SelectorChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="223"/>
</connections>
</segmentedControl>
</barButtonItem>
</items>
</toolbar>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="8Mg-Su-3Lf" firstAttribute="bottom" secondItem="hGv-4F-dpM" secondAttribute="bottom" id="C2i-gf-Xrg"/>
<constraint firstItem="8Mg-Su-3Lf" firstAttribute="trailing" secondItem="hGv-4F-dpM" secondAttribute="trailing" id="ZLy-Az-0d1"/>
<constraint firstAttribute="bottom" secondItem="vAR-1N-jN7" secondAttribute="bottom" id="ZgF-Wf-uD8"/>
<constraint firstAttribute="trailing" secondItem="vAR-1N-jN7" secondAttribute="trailing" id="gw2-gN-Yw6"/>
<constraint firstItem="hGv-4F-dpM" firstAttribute="leading" secondItem="8Mg-Su-3Lf" secondAttribute="leading" id="kvo-Qi-NAi"/>
<constraint firstItem="vAR-1N-jN7" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="rqc-vZ-PDr"/>
<constraint firstItem="vAR-1N-jN7" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="sXF-XA-kn3"/>
</constraints>
<viewLayoutGuide key="safeArea" id="8Mg-Su-3Lf"/>
</view>
<navigationItem key="navigationItem" id="1v1-OR-9K4"/>
<connections>
<outlet property="mapView" destination="vAR-1N-jN7" id="name-outlet-vAR-1N-jN7"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1072.8" y="133.58320000000001"/>
</scene>
<!--Cities View Controller-->
<scene sceneID="Jdp-Fg-mCf">
<objects>
<tableViewController id="pni-sa-b4n" customClass="CitiesViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="ZcI-cf-eh8">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cellIdentifier" textLabel="HuU-pu-OC9" detailTextLabel="YKM-9i-az5" style="IBUITableViewCellStyleSubtitle" id="lkG-GB-QnO">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="lkG-GB-QnO" id="KXj-KW-uFI">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HuU-pu-OC9">
<rect key="frame" x="16" y="5" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Subtitle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="YKM-9i-az5">
<rect key="frame" x="16" y="25.5" width="44" height="14.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="pni-sa-b4n" id="J7b-mi-9kx"/>
<outlet property="delegate" destination="pni-sa-b4n" id="4ZW-1b-Oo4"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="MFU-VN-khW" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1825" y="134"/>
</scene>
</scenes>
</document>

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

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier" propertyAccessControl="none" initialViewController="2">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
</dependencies>
<scenes>
<!--World Cities View Controller-->
<scene sceneID="5">
<objects>
<viewController id="2" customClass="WorldCitiesViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="6">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" fixedFrame="YES" id="7">
<rect key="frame" x="0.0" y="416" width="325" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<animations/>
<items>
<barButtonItem systemItem="bookmarks" id="8">
<connections>
<segue destination="73" kind="modal" id="81"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="9"/>
<barButtonItem style="plain" id="12">
<segmentedControl key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="11">
<rect key="frame" x="115" y="8" width="203" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<segments>
<segment title="Standard"/>
<segment title="Satellite"/>
<segment title="Hybrid"/>
</segments>
<connections>
<action selector="SelectorChanged:" destination="2" eventType="valueChanged" id="28"/>
</connections>
</segmentedControl>
</barButtonItem>
</items>
</toolbar>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" mapType="standard" id="25">
<rect key="frame" x="0.0" y="0.0" width="320" height="416"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
</mapView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="MapView" destination="25" id="26"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="125" y="106"/>
</scene>
<!--World Cities List Controller-->
<scene sceneID="76">
<objects>
<viewController id="73" customClass="WorldCitiesListController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="74">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="87">
<rect key="frame" x="0.0" y="44" width="320" height="416"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Iq7-8t-zFF" detailTextLabel="APX-Td-H6D" style="IBUITableViewCellStyleSubtitle" id="88">
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="88" id="KRV-MF-jTU">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Iq7-8t-zFF">
<rect key="frame" x="0.0" y="4" width="37.5" height="21.5"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Subtitle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="APX-Td-H6D">
<rect key="frame" x="0.0" y="25.5" width="40.5" height="13.5"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</prototypes>
</tableView>
<navigationBar contentMode="scaleToFill" fixedFrame="YES" id="77">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<animations/>
<items>
<navigationItem title="WorldCities" id="78"/>
</items>
</navigationBar>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="TableView" destination="87" id="89"/>
<segue destination="2" kind="modal" identifier="MoveToMap" id="90"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="75" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="638" y="106"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>

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

@ -0,0 +1,13 @@
namespace WorldCities
{
public class CityEventArgs : System.EventArgs
{
public WorldCity City { get; private set; }
public CityEventArgs(WorldCity city)
{
City = city;
}
}
}

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

@ -0,0 +1,19 @@
namespace WorldCities
{
public class WorldCity
{
public WorldCity(string name, double latitude, double longitude)
{
this.Name = name;
this.Latitude = latitude;
this.Longitude = longitude;
}
public string Name { get; private set; }
public double Latitude { get; private set; }
public double Longitude { get; private set; }
}
}

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

@ -0,0 +1,84 @@
using CoreLocation;
using Foundation;
using MapKit;
using ObjCRuntime;
using System;
using UIKit;
namespace WorldCities
{
public partial class ViewController : UIViewController
{
private WorldCity selectedCity;
protected ViewController(IntPtr handle) : base(handle) { }
partial void SelectorChanged(UISegmentedControl sender)
{
switch (sender.SelectedSegment)
{
case 1:
mapView.MapType = MapKit.MKMapType.Satellite;
break;
case 2:
mapView.MapType = MapKit.MKMapType.Hybrid;
break;
default:
mapView.MapType = MapKit.MKMapType.Standard;
break;
}
}
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
{
if (segue?.DestinationViewController is CitiesViewController controller)
{
controller.CityChanged += OnCityChanged;
}
}
private void OnCityChanged(object sender, CityEventArgs e)
{
(sender as CitiesViewController).CityChanged -= OnCityChanged;
selectedCity = e.City;
ChooseWorldCity();
}
private void ChooseWorldCity()
{
var place = selectedCity;
Title = place.Name;
var current = mapView.Region;
if (current.Span.LatitudeDelta < 10)
{
PerformSelector(new Selector("AnimateToWorld"), null, 0.3f);
PerformSelector(new Selector("AnimateToPlace"), null, 1.7f);
}
else
{
PerformSelector(new Selector("AnimateToPlace"), null, 0.3f);
}
}
[Export("AnimateToWorld")]
private void AnimateToWorld()
{
var city = selectedCity;
var region = mapView.Region;
var zoomOut = new MKCoordinateRegion(new CLLocationCoordinate2D((region.Center.Latitude + city.Latitude) / 2d,
(region.Center.Longitude + city.Longitude) / 2d),
new MKCoordinateSpan(90, 90));
mapView.SetRegion(zoomOut, true);
}
[Export("AnimateToPlace")]
private void AnimateToPlace()
{
var city = selectedCity;
var region = new MKCoordinateRegion(new CLLocationCoordinate2D(city.Latitude, city.Longitude),
new MKCoordinateSpan(0.4, 0.4));
mapView.SetRegion(region, true);
}
}
}

32
WorldCities/WorldCities/ViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,32 @@
// 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 WorldCities
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
MapKit.MKMapView mapView { get; set; }
[Action ("SelectorChanged:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void SelectorChanged (UIKit.UISegmentedControl sender);
void ReleaseDesignerOutlets ()
{
if (mapView != null) {
mapView.Dispose ();
mapView = null;
}
}
}
}

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

@ -0,0 +1,136 @@
<?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>{F8BB128E-1ADD-43E2-B819-FBA79DA19B7A}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>WorldCities</RootNamespace>
<AssemblyName>WorldCities</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>
<IOSDebuggerPort>29145</IOSDebuggerPort>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<DeviceSpecificBuild>false</DeviceSpecificBuild>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants></DefineConstants>
<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>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</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>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<IOSDebuggerPort>15775</IOSDebuggerPort>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</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-83.5%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%403x.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" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
<Compile Include="CitiesViewController.cs" />
<Compile Include="CitiesViewController.designer.cs">
<DependentUpon>CitiesViewController.cs</DependentUpon>
</Compile>
<Compile Include="Models\WorldCity.cs" />
<Compile Include="Models\CityEventArgs.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\CityList.plist" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

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

@ -1,84 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace WorldCities
{
public partial class WorldCitiesListController : UIViewController
{
const string MoveToMapSegueName = "MoveToMap";
List<WorldCity> cityList = new List<WorldCity> ();
public WorldCity SelectedCity { get; set; }
public WorldCitiesListController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
var path = NSBundle.MainBundle.PathForResource ("CityList", "plist");
var cities = NSArray.FromFile (path);
foreach (var city in NSArray.FromArray <NSDictionary> (cities)) {
cityList.Add (new WorldCity (city[(NSString)"cityNameKey"].ToString (),
double.Parse (city[(NSString)"latitudeKey"].ToString ()),
double.Parse (city[(NSString)"longitudeKey"].ToString ())));
}
TableView.Source = new MyTableViewDelegate (this);
}
public override void ViewDidAppear (bool animated)
{
base.ViewDidAppear (animated);
}
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue (segue, sender);
if (segue.Identifier == MoveToMapSegueName) {
var view = (WorldCitiesViewController)segue.DestinationViewController;
view.SelectedCity = SelectedCity;
}
}
class MyTableViewDelegate : UITableViewSource
{
WorldCitiesListController controller;
public MyTableViewDelegate (WorldCitiesListController controller)
{
this.controller = controller;
}
public override nint RowsInSection (UITableView tableview, nint section)
{
return controller.cityList.Count;
}
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
const string cellName = "Cell";
var cell = tableView.DequeueReusableCell (cellName);
if (cell == null) {
cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellName);
cell.EditingAccessory = UITableViewCellAccessory.DetailDisclosureButton;
}
var city = controller.cityList [indexPath.Row];
cell.TextLabel.Text = city.Name;
cell.DetailTextLabel.Text = string.Format ("{0} {1}", city.Latitude, city.Longitude);
return cell;
}
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
controller.SelectedCity = controller.cityList [indexPath.Row];
controller.PerformSegue (MoveToMapSegueName, controller);
}
}
}
}

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

@ -1,17 +0,0 @@
// WARNING
//
// This file has been generated automatically by MonoDevelop to store outlets and
// actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
namespace WorldCities
{
[Register ("WorldCitiesListController")]
partial class WorldCitiesListController
{
[Outlet]
UIKit.UITableView TableView { get; set; }
}
}

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

@ -1,108 +0,0 @@
//
// WorldCitiesViewController.cs
//
// Author:
// Mike Krüger <mkrueger@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using UIKit;
using CoreGraphics;
using System;
using Foundation;
using System.Collections.Generic;
using MapKit;
using CoreLocation;
using ObjCRuntime;
namespace WorldCities
{
public partial class WorldCitiesViewController : UIViewController
{
public WorldCity SelectedCity { get; set; }
public WorldCitiesViewController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
if (SelectedCity != null)
ChooseWorldCity ();
}
partial void SelectorChanged (Foundation.NSObject sender)
{
var segmented = sender as UISegmentedControl;
if (segmented == null)
return;
switch (segmented.SelectedSegment) {
case 1:
MapView.MapType = MapKit.MKMapType.Satellite;
break;
case 2:
MapView.MapType = MapKit.MKMapType.Hybrid;
break;
default:
MapView.MapType = MapKit.MKMapType.Standard;
break;
}
}
[Export("AnimateToWorld")]
void AnimateToWorld ()
{
var worldCity = SelectedCity;
var current = MapView.Region;
var zoomOut = new MKCoordinateRegion (new CLLocationCoordinate2D ((current.Center.Latitude + worldCity.Latitude) / 2.0, (current.Center.Longitude + worldCity.Longitude) / 2.0),
new MKCoordinateSpan (90, 90));
MapView.SetRegion (zoomOut, true);
}
[Export("AnimateToPlace")]
void AnimateToPlace ()
{
var worldCity = SelectedCity;
var region = new MKCoordinateRegion (new CLLocationCoordinate2D (worldCity.Latitude, worldCity.Longitude),
new MKCoordinateSpan (0.4, 0.4));
MapView.SetRegion (region, true);
}
void ChooseWorldCity ()
{
var aPlace = SelectedCity;
Title = aPlace.Name;
var current = MapView.Region;
if (current.Span.LatitudeDelta < 10) {
PerformSelector (new Selector ("AnimateToWorld"), null, 0.3f);
PerformSelector (new Selector ("AnimateToPlace"), null, 1.7f);
} else {
PerformSelector (new Selector ("AnimateToPlace"), null, 0.3f);
}
}
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
}
}

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

@ -1,20 +0,0 @@
// WARNING
//
// This file has been generated automatically by MonoDevelop to store outlets and
// actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
namespace WorldCities
{
[Register ("WorldCitiesViewController")]
partial class WorldCitiesViewController
{
[Outlet]
MapKit.MKMapView MapView { get; set; }
[Action ("SelectorChanged:")]
partial void SelectorChanged (Foundation.NSObject sender);
}
}

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

@ -1,45 +0,0 @@
//
// WorldCity.cs
//
// Author:
// Mike Krüger <mkrueger@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace WorldCities
{
public class WorldCity
{
public string Name { get; private set; }
public double Latitude { get; private set; }
public double Longitude { get; private set; }
public WorldCity (string name, double latitude, double longitude)
{
this.Name = name;
this.Latitude = latitude;
this.Longitude = longitude;
}
}
}