Update 'MapKitSeach' sample (#299)
* added new project * deleted old project * updated info.plist * added docs
|
@ -1,109 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CoreLocation;
|
||||
using Foundation;
|
||||
using MonoTouch.Dialog;
|
||||
using MapKit;
|
||||
using UIKit;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MapKitSearch {
|
||||
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
|
||||
UIWindow window;
|
||||
CLLocationManager lm;
|
||||
CLLocation here;
|
||||
List<MKMapItem> results = new List<MKMapItem> ();
|
||||
|
||||
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
|
||||
{
|
||||
window = new UIWindow (UIScreen.MainScreen.Bounds);
|
||||
|
||||
var what = new EntryElement ("What ?", "e.g. pizza", String.Empty);
|
||||
var where = new EntryElement ("Where ?", "here", String.Empty);
|
||||
|
||||
var section = new Section ();
|
||||
if (CLLocationManager.LocationServicesEnabled) {
|
||||
lm = new CLLocationManager ();
|
||||
lm.LocationsUpdated += delegate (object sender, CLLocationsUpdatedEventArgs e) {
|
||||
lm.StopUpdatingLocation ();
|
||||
here = e.Locations [e.Locations.Length - 1];
|
||||
var coord = here.Coordinate;
|
||||
where.Value = String.Format ("{0:F4}, {1:F4}", coord.Longitude, coord.Latitude);
|
||||
};
|
||||
section.Add (new StringElement ("Get Current Location", delegate {
|
||||
lm.StartUpdatingLocation ();
|
||||
}));
|
||||
}
|
||||
|
||||
section.Add (new StringElement ("Search...", async delegate {
|
||||
await SearchAsync (what.Value, where.Value);
|
||||
}));
|
||||
|
||||
var root = new RootElement ("MapKit Search Sample") {
|
||||
new Section ("MapKit Search Sample") { what, where },
|
||||
section
|
||||
};
|
||||
window.RootViewController = new UINavigationController (new DialogViewController (root, true));
|
||||
window.MakeKeyAndVisible ();
|
||||
return true;
|
||||
}
|
||||
|
||||
CLLocationCoordinate2D Parse (string s)
|
||||
{
|
||||
if (!String.IsNullOrEmpty (s)) {
|
||||
string[] values = s.Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (values.Length == 2) {
|
||||
double longitude, latitude;
|
||||
if (Double.TryParse (values [0], out longitude) && Double.TryParse (values [1], out latitude))
|
||||
return new CLLocationCoordinate2D (longitude, latitude);
|
||||
}
|
||||
}
|
||||
return new CLLocationCoordinate2D ();
|
||||
}
|
||||
|
||||
async Task SearchAsync (string what, string where)
|
||||
{
|
||||
var coord = here == null ? Parse (where) : here.Coordinate;
|
||||
|
||||
MKCoordinateSpan span = new MKCoordinateSpan (0.25, 0.25);
|
||||
MKLocalSearchRequest request = new MKLocalSearchRequest ();
|
||||
request.Region = new MKCoordinateRegion (coord, span);
|
||||
request.NaturalLanguageQuery = what;
|
||||
MKLocalSearch search = new MKLocalSearch (request);
|
||||
MKLocalSearchResponse response;
|
||||
try{
|
||||
response = await search.StartAsync ();
|
||||
|
||||
}
|
||||
catch {
|
||||
return;
|
||||
}
|
||||
if (response == null)
|
||||
return;
|
||||
|
||||
var section = new Section ("Search Results for " + what);
|
||||
results.Clear ();
|
||||
foreach (MKMapItem mi in response.MapItems) {
|
||||
results.Add (mi);
|
||||
var element = new StyledStringElement (mi.Name, mi.PhoneNumber, UITableViewCellStyle.Subtitle);
|
||||
element.Accessory = UITableViewCellAccessory.DisclosureIndicator;
|
||||
element.Tapped += () => { results [element.IndexPath.Row].OpenInMaps (); };
|
||||
section.Add (element);
|
||||
}
|
||||
|
||||
var root = new RootElement ("MapKit Search Sample") { section };
|
||||
var dvc = new DialogViewController (root);
|
||||
(window.RootViewController as UINavigationController).PushViewController (dvc, true);
|
||||
|
||||
}
|
||||
|
||||
static void Main (string[] args)
|
||||
{
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?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>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>MapKitSearch</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.mapkitsearch</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>9.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,106 +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>{84315F67-2869-4A97-A63C-904390127F04}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>MapKitSearch</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>MapKitSearch</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>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</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>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</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>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<BuildIpa>True</BuildIpa>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoTouch.Dialog-1" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapKitSearch", "MapKitSearch.csproj", "{84315F67-2869-4A97-A63C-904390127F04}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapKitSearch", "MapKitSearch\MapKitSearch.csproj", "{B776ACE8-1772-4165-8A4F-AC418316C1B7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -13,18 +13,18 @@ Global
|
|||
AppStore|iPhone = AppStore|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{84315F67-2869-4A97-A63C-904390127F04}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.AppStore|iPhone.ActiveCfg = Release|iPhone
|
||||
{B776ACE8-1772-4165-8A4F-AC418316C1B7}.AppStore|iPhone.Build.0 = Release|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = MapKitSearch.csproj
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MapKitSearch
|
||||
{
|
||||
// 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
|
||||
{
|
||||
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"
|
||||
}
|
||||
}
|
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/Icon-app-60@3x.png
Normal file
После Ширина: | Высота: | Размер: 5.0 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/Icon-app-83.5@2x.png
Normal file
После Ширина: | Высота: | Размер: 8.6 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/app-store-logo.png
Normal file
После Ширина: | Высота: | Размер: 22 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-app-60@2x.png
Normal file
После Ширина: | Высота: | Размер: 3.3 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-app-76.png
Normal file
После Ширина: | Высота: | Размер: 2.0 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-app-76@2x.png
Normal file
После Ширина: | Высота: | Размер: 4.3 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-spotlight-29.png
Normal file
После Ширина: | Высота: | Размер: 900 B |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-spotlight-29@2x.png
Normal file
После Ширина: | Высота: | Размер: 1.8 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-spotlight-29@3x.png
Normal file
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-spotlight-40.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-spotlight-40@2x.png
Normal file
После Ширина: | Высота: | Размер: 2.2 KiB |
Двоичные данные
MapKitSearch/MapKitSearch/Assets.xcassets/AppIcon.appiconset/icon-spotlight-40@3x.png
Normal file
После Ширина: | Высота: | Размер: 3.3 KiB |
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
|
@ -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,42 @@
|
|||
<?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>MapKit Search</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.xamarin.MapKitSearch</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>9.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>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Using your location to search where you are.</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS" />
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</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 MapKitSearch
|
||||
{
|
||||
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,161 @@
|
|||
<?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" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="QyY-7F-WPe">
|
||||
<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>
|
||||
<!--MapKit Search Sample-->
|
||||
<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>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="What?" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ogu-ge-SQ1">
|
||||
<rect key="frame" x="16" y="86" width="60" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="eYi-qk-qgm"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="e.g. pizza" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="n49-Wk-odh">
|
||||
<rect key="frame" x="84" y="81.5" width="275" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Where?" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="L7R-9F-OZx">
|
||||
<rect key="frame" x="16" y="126.5" width="60" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="KOI-cO-peI"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="42.35, -71.05" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="2kZ-0q-tY5">
|
||||
<rect key="frame" x="84" y="122" width="275" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fTA-G2-GV8">
|
||||
<rect key="frame" x="115.5" y="202" width="144" height="30"/>
|
||||
<state key="normal" title="Get Current Location"/>
|
||||
<connections>
|
||||
<action selector="GetCurrentLocation:" destination="BYZ-38-t0r" eventType="touchUpInside" id="239"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="z6i-QU-ckS">
|
||||
<rect key="frame" x="157" y="240" width="61" height="30"/>
|
||||
<state key="normal" title="Search..."/>
|
||||
<connections>
|
||||
<action selector="Search:" destination="BYZ-38-t0r" eventType="touchUpInside" id="240"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="z6i-QU-ckS" firstAttribute="centerX" secondItem="JUY-Ey-agZ" secondAttribute="centerX" id="AGQ-S4-dxC"/>
|
||||
<constraint firstItem="L7R-9F-OZx" firstAttribute="leading" secondItem="JUY-Ey-agZ" secondAttribute="leading" constant="16" id="BS1-KS-yBv"/>
|
||||
<constraint firstItem="n49-Wk-odh" firstAttribute="centerY" secondItem="ogu-ge-SQ1" secondAttribute="centerY" id="CNI-HQ-K8u"/>
|
||||
<constraint firstItem="L7R-9F-OZx" firstAttribute="top" secondItem="ogu-ge-SQ1" secondAttribute="bottom" constant="20" id="QQz-f9-6yU"/>
|
||||
<constraint firstItem="z6i-QU-ckS" firstAttribute="top" secondItem="fTA-G2-GV8" secondAttribute="bottom" constant="8" id="VeH-Ie-JDo"/>
|
||||
<constraint firstItem="JUY-Ey-agZ" firstAttribute="trailing" secondItem="n49-Wk-odh" secondAttribute="trailing" constant="16" id="Whp-EN-jnF"/>
|
||||
<constraint firstItem="fTA-G2-GV8" firstAttribute="top" secondItem="2kZ-0q-tY5" secondAttribute="bottom" constant="50" id="gS8-5B-yFG"/>
|
||||
<constraint firstItem="ogu-ge-SQ1" firstAttribute="leading" secondItem="JUY-Ey-agZ" secondAttribute="leading" constant="16" id="hK0-25-dBZ"/>
|
||||
<constraint firstItem="JUY-Ey-agZ" firstAttribute="trailing" secondItem="2kZ-0q-tY5" secondAttribute="trailing" constant="16" id="iHO-5I-3Zw"/>
|
||||
<constraint firstItem="2kZ-0q-tY5" firstAttribute="leading" secondItem="L7R-9F-OZx" secondAttribute="trailing" constant="8" symbolic="YES" id="ndh-fi-Fsd"/>
|
||||
<constraint firstItem="fTA-G2-GV8" firstAttribute="centerX" secondItem="JUY-Ey-agZ" secondAttribute="centerX" id="o1V-Lq-Qey"/>
|
||||
<constraint firstItem="n49-Wk-odh" firstAttribute="leading" secondItem="ogu-ge-SQ1" secondAttribute="trailing" constant="8" symbolic="YES" id="s1y-iS-KrJ"/>
|
||||
<constraint firstItem="2kZ-0q-tY5" firstAttribute="centerY" secondItem="L7R-9F-OZx" secondAttribute="centerY" id="trC-2N-3t3"/>
|
||||
<constraint firstItem="ogu-ge-SQ1" firstAttribute="top" secondItem="JUY-Ey-agZ" secondAttribute="top" constant="16" id="vZo-TS-Q2l"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="JUY-Ey-agZ"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="MapKit Search Sample" id="514-Pe-m1t"/>
|
||||
<connections>
|
||||
<outlet property="LocationTextField" destination="2kZ-0q-tY5" id="name-outlet-2kZ-0q-tY5"/>
|
||||
<outlet property="QueryTextField" destination="n49-Wk-odh" id="name-outlet-n49-Wk-odh"/>
|
||||
<segue destination="Asr-4l-lcm" kind="show" identifier="openSearchResults" id="myt-Pm-Q1e"/>
|
||||
<outlet property="SearchButton" destination="z6i-QU-ckS" id="name-outlet-z6i-QU-ckS"/>
|
||||
<outlet property="GetLocationButton" destination="fTA-G2-GV8" id="name-outlet-fTA-G2-GV8"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1096.8" y="146.1769"/>
|
||||
</scene>
|
||||
<!--Search Results Controller-->
|
||||
<scene sceneID="ua8-2t-2bg">
|
||||
<objects>
|
||||
<tableViewController id="Asr-4l-lcm" customClass="SearchResultsController" 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="Fw0-ge-OkL">
|
||||
<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" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="cellIdentifier" textLabel="zo6-US-6iD" detailTextLabel="Qeo-nW-F2A" style="IBUITableViewCellStyleSubtitle" id="9dd-eg-NXJ">
|
||||
<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="9dd-eg-NXJ" id="LfW-jw-FIJ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="341" 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="zo6-US-6iD">
|
||||
<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="Detail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Qeo-nW-F2A">
|
||||
<rect key="frame" x="16" y="25.5" width="33" 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="Asr-4l-lcm" id="Doa-Qx-jch"/>
|
||||
<outlet property="delegate" destination="Asr-4l-lcm" id="BO1-Vx-LD6"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="LzK-G7-aWR" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1857" y="145"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="5KY-td-2Z2">
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="QyY-7F-WPe" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="e7d-7s-jTL">
|
||||
<rect key="frame" x="0.0" y="20" width="375" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="ZgS-Fb-oAX"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="kpz-rx-XMk" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="264.8" y="146.1769"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
|
@ -0,0 +1,128 @@
|
|||
<?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>{B776ACE8-1772-4165-8A4F-AC418316C1B7}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>MapKitSearch</RootNamespace>
|
||||
<AssemblyName>MapKitSearch</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>60445</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>40341</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-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%402x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%403x.png" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40.png" />
|
||||
</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="SearchResultsController.cs" />
|
||||
<Compile Include="SearchResultsController.designer.cs">
|
||||
<DependentUpon>SearchResultsController.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,46 @@
|
|||
using Foundation;
|
||||
using MapKit;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace MapKitSearch
|
||||
{
|
||||
public partial class SearchResultsController : UITableViewController
|
||||
{
|
||||
private const string CellIdentifier = "cellIdentifier";
|
||||
|
||||
public SearchResultsController (IntPtr handle) : base (handle) { }
|
||||
|
||||
public MKMapItem[] Items { get; set; }
|
||||
|
||||
public string Query { get; set; }
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
NavigationItem.Title = Query;
|
||||
}
|
||||
|
||||
public override nint RowsInSection(UITableView tableView, nint section)
|
||||
{
|
||||
return Items.Length;
|
||||
}
|
||||
|
||||
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
|
||||
{
|
||||
var cell = tableView.DequeueReusableCell(CellIdentifier, indexPath);
|
||||
|
||||
var item = Items[indexPath.Row];
|
||||
cell.TextLabel.Text = item.Name;
|
||||
cell.DetailTextLabel.Text = item.PhoneNumber;
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
|
||||
{
|
||||
Items[indexPath.Row].OpenInMaps();
|
||||
tableView.DeselectRow(indexPath, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// 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 MapKitSearch
|
||||
{
|
||||
[Register ("SearchResultsController")]
|
||||
partial class SearchResultsController
|
||||
{
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
using CoreLocation;
|
||||
using Foundation;
|
||||
using MapKit;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using UIKit;
|
||||
|
||||
namespace MapKitSearch
|
||||
{
|
||||
public partial class ViewController : UIViewController, IUITextFieldDelegate
|
||||
{
|
||||
private const string SearchSegueIdentifier = "openSearchResults";
|
||||
|
||||
private CLLocationManager locationManager;
|
||||
|
||||
private MKMapItem[] searchItems;
|
||||
|
||||
protected ViewController(IntPtr handle) : base(handle) { }
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
SearchButton.Enabled = false;
|
||||
QueryTextField.Delegate = this;
|
||||
LocationTextField.Delegate = this;
|
||||
|
||||
GetLocationButton.Enabled = CLLocationManager.LocationServicesEnabled;
|
||||
QueryTextField.AddTarget((sender, e) => SearchButton.Enabled = !string.IsNullOrEmpty(QueryTextField.Text),
|
||||
UIControlEvent.EditingChanged);
|
||||
|
||||
if (CLLocationManager.LocationServicesEnabled)
|
||||
{
|
||||
locationManager = new CLLocationManager();
|
||||
locationManager.RequestWhenInUseAuthorization();
|
||||
locationManager.LocationsUpdated += (sender, e) =>
|
||||
{
|
||||
locationManager.StopUpdatingLocation();
|
||||
var location = e.Locations[e.Locations.Length - 1];
|
||||
LocationTextField.Text = string.Format("{0:F4}, {1:F4}", location.Coordinate.Latitude, location.Coordinate.Longitude);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
partial void GetCurrentLocation(UIButton sender)
|
||||
{
|
||||
locationManager.StartUpdatingLocation();
|
||||
}
|
||||
|
||||
async partial void Search(UIButton sender)
|
||||
{
|
||||
await SearchAsync(QueryTextField.Text, LocationTextField.Text).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(segue?.Identifier) && segue.Identifier == SearchSegueIdentifier)
|
||||
{
|
||||
if(segue.DestinationViewController is SearchResultsController searchResultsController)
|
||||
{
|
||||
searchResultsController.Query = QueryTextField.Text;
|
||||
searchResultsController.Items = searchItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SearchAsync(string what, string where)
|
||||
{
|
||||
var span = new MKCoordinateSpan(0.25, 0.25);
|
||||
var request = new MKLocalSearchRequest
|
||||
{
|
||||
NaturalLanguageQuery = what,
|
||||
Region = new MKCoordinateRegion(ParseCoordinates(where), span),
|
||||
};
|
||||
|
||||
var search = new MKLocalSearch(request);
|
||||
MKLocalSearchResponse response = null;
|
||||
|
||||
try
|
||||
{
|
||||
response = await search.StartAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(ex);
|
||||
}
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
searchItems = response.MapItems;
|
||||
PerformSegue(SearchSegueIdentifier, this);
|
||||
}
|
||||
}
|
||||
|
||||
private CLLocationCoordinate2D ParseCoordinates(string coordinates)
|
||||
{
|
||||
var result = new CLLocationCoordinate2D();
|
||||
|
||||
if (!string.IsNullOrEmpty(coordinates))
|
||||
{
|
||||
var values = coordinates.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (values.Length == 2)
|
||||
{
|
||||
if (double.TryParse(values[0], out double latitude) &&
|
||||
double.TryParse(values[1], out double longitude))
|
||||
{
|
||||
result = new CLLocationCoordinate2D(latitude, longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#region IUITextFieldDelegate
|
||||
|
||||
[Export("textFieldShouldReturn:")]
|
||||
public bool ShouldReturn(UITextField textField)
|
||||
{
|
||||
if (textField == QueryTextField)
|
||||
{
|
||||
LocationTextField.BecomeFirstResponder();
|
||||
}
|
||||
else
|
||||
{
|
||||
textField.ResignFirstResponder();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
// 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 MapKitSearch
|
||||
{
|
||||
[Register ("ViewController")]
|
||||
partial class ViewController
|
||||
{
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UIButton GetLocationButton { get; set; }
|
||||
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UITextField LocationTextField { get; set; }
|
||||
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UITextField QueryTextField { get; set; }
|
||||
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UIButton SearchButton { get; set; }
|
||||
|
||||
[Action ("GetCurrentLocation:")]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
partial void GetCurrentLocation (UIKit.UIButton sender);
|
||||
|
||||
[Action ("Search:")]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
partial void Search (UIKit.UIButton sender);
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
if (GetLocationButton != null) {
|
||||
GetLocationButton.Dispose ();
|
||||
GetLocationButton = null;
|
||||
}
|
||||
|
||||
if (LocationTextField != null) {
|
||||
LocationTextField.Dispose ();
|
||||
LocationTextField = null;
|
||||
}
|
||||
|
||||
if (QueryTextField != null) {
|
||||
QueryTextField.Dispose ();
|
||||
QueryTextField = null;
|
||||
}
|
||||
|
||||
if (SearchButton != null) {
|
||||
SearchButton.Dispose ();
|
||||
SearchButton = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SampleMetadata>
|
||||
<ID>40e06d5c-e298-11e8-9f32-f2801f1b9fd1/ID>
|
||||
<IsFullApplication>false</IsFullApplication>
|
||||
<Brief>This sample demonstrates how to use MapKit.</Brief>
|
||||
<SupportedPlatforms>iOS</SupportedPlatforms>
|
||||
<Level>Beginner</Level>
|
||||
<Tags>MapKit</Tags>
|
||||
<Gallery>true</Gallery>
|
||||
</SampleMetadata>
|
|
@ -0,0 +1,16 @@
|
|||
MapkitViewer
|
||||
============
|
||||
|
||||
This sample demonstrates how to use MapKit.
|
||||
|
||||
![Home Screen](Screenshots/screenshot-1.png)
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Xamarin port changes are released under the MIT license.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Mykyta Bondarenko
|
После Ширина: | Высота: | Размер: 20 KiB |
После Ширина: | Высота: | Размер: 38 KiB |