平成30年8月20日(月曜日)
objective-c版 stackview設定
Add views in UIStackView programmatically
平成30年7月24日(火曜日)
detailCalloutAccessoryView要調査!!
平成30年7月15日(日曜日)
色分け設定(白背景、文字赤)、menuviewテーブル(市町村別、セクション別)表示、タップ対応、itembutton押下まで動作完了。
平成30年7月14日(土曜日)
試行の結果、クラスタリング不使用、MKMarkerAnnotationView使用(理由は、マーカーに文字表示可能なこと、更に色分けすれば、視認性向上による)
本日ここまで、これをベースに更に深化予定。
平成30年7月13日(金曜日)
MKMarkerAnnotationViewによる、おでかけスポット表示、骨格はほぼ完了!!
残るは、sectionによる色分け表示(markerTintColor、glyphTintColor)、coredata predicate関係、写真、詳細画面表示など。
平成30年7月12日(木曜日)
MKMarkerAnnotationViewについて、ひとまず完了!!
MKMarkerAnnotationView –> Tips
順序
MKAnnotation、更にMKAnnotationView
必要なパラメーターは、MKAnnotation作成時点で渡すこと。(MKAnnotationView内で設定)
MKAnnotation
① マーカー表示のみであれば、coordinateのみでOK!!
② calloutする場合は、最低限、titleが必要(更に詳細があれば、subutitleまで)
MKMarkerAnnotationView
① markerTintColor(マーカー色 丸いマーカーのこと)
② glyphTintColor(glyphTextの色、glyphImageは変化しない。)
③ glyphText(日本語漢字表示で二文字まで実用可)
④ glyphImage(= UIImage(named: “hotspring.png”))
↑を表示するには、glyphTextを設定しないこと。
又、glyphImageは詳細表示ではなく、輪郭が表示されるのみ。。
①②③④を使い分ければ、識別可能か!!
残るは、detailの複数行表示!!(以下の最後のもので解決)
how to show multiple lines in MKAnnotation with autolayout?
leftCalloutAccessoryViewについて、以下の最後のもので解決
MapKit iOS 9 detailCalloutAccessoryView usage
更にサイズ調整!!(但し、縮小されて見づらい、icon表示サイズ)
Resizing image to fit in MapView’s leftCalloutAccessoryView
平成30年7月11日(水曜日)
未確認リンク
Building the perfect iOS Map (II): Completely custom annotation views
how to show multiple lines in MKAnnotation with autolayout?
most simple MKMarkerAnnotationView
//---------------------------------------------------
class StandardAnnotation: NSObject, MKAnnotation {
let coordinate: CLLocationCoordinate2D
let title: String?
let subtitle: String?
init(coordinate: CLLocationCoordinate2D,title:String,subtitle:String) {
self.coordinate = coordinate
// Calloutの場合は、以下必要(titleのみでも可)
self.title = title
self.subtitle = subtitle
}
}
//---------------------------------------------------
現在地表示!!
if annotation is MKUserLocation {
return nil
}
平成30年7月10日(火曜日)
coredataからの読み込み、MKMarkerAnnotationViewによるmapkit表示完了!!
平成30年7月7日(土曜日)
再学習 以下リンク
① Annotation(独自画像)(AnnotationView 独自画像、テキスト、button action有り)オールカスタマイズ版
Update December 2017: Fully updated for Xcode 9 and Swift 4.
How To Completely Customise Your Map Annotations Callout Views
CustomCalloutView-Starter project
② MKMarkerAnnotationView及びMKAnnotationView対応(source内でコメントアウト)
コールアウト画面の複数行対応等
calloutAccessoryControlTapped有り
MapKit Tutorial: Getting Started
HonoluluArt
その他、参考!!
How to add a button to an MKMapView annotation
Use Markers Instead of Pins for Map Annotations
たたき台として、有用!!2018年06月29日に更新
【swift4:開発メモ①】 MapKit⑴
その他動作確認等
下調べ・・・
以下リンクにて完動!!(swift4.1 Version 9.4 )
Working with Maps on iOS 11 with MapKit and the MKMapView Class
③プログラム mapkit_swift4
↓以下 コピペにて完動!! swift4.1
iOS11 アノテーション クラスタリング
④プログラム mapkit_swift4A
平成30年7月6日(金曜日)
MKMarkerAnnotationView学習!!
①MKAnnotation(必須)継承し、自らcall!!
②func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {} delegate メソッド
更に
MKAnnotationView(
MKPinAnnotationView
markerAnnotationView(新機能)
)
pin image 変更
pinView!.image = UIImage(named:”GreenDot”)!
平成30年7月5日(木曜日)
以前のAapKit…
MyAnnotation() → addAnnotation
更に、おそらくdelegateにてcalled!! viewForAnnotation
plot()
//----------------------------------------
// 色別アノテーション作成
switch read_csv!.csv.rows[i]["section"]!
{
case "滝・川・湖":
let myAnnotation = MyAnnotation(pincolor: sections.sections["滝・川・湖"]!,title: name,subtitle:SubTitle,pin_style:"image",coordinate: location)
self.mapView.addAnnotation(myAnnotation)
case "その他":
let myAnnotation = MyAnnotation(pincolor: sections.sections["その他"]!,title: name,subtitle: SubTitle,pin_style:"pin",coordinate: location)
self.mapView.addAnnotation(myAnnotation)
}
//----------------------------------------
//----------------------------
// 標準アノテーション 改!! pin_style追加
//----------------------------
class MyAnnotation: NSObject, MKAnnotation
{
let pincolor: String
let title: String?
let subtitle: String?
let coordinate: CLLocationCoordinate2D
// 追加
let pin_style:String
init(pincolor: String, title: String, subtitle: String, pin_style: String,coordinate: CLLocationCoordinate2D)
{
self.pincolor = pincolor
self.title = title
self.subtitle = subtitle
self.coordinate = coordinate
// 追加
self.pin_style = pin_style
super.init()
}
}
//----------------------------
// ピンまたはイメージによる描画
//----------------------------
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView?
{
if let annotation = annotation as? MyAnnotation
{
//print(annotation.pin_style)
//=============================================================
if annotation.pin_style == "pin" {
...
//=============================================================
} else if annotation.pin_style == "image" {
}
}
平成30年7月5日(木曜日)
annotation関係再学習。loop無しに「??」なれど、配列渡しで納得か!!
今後は、新機能の学習予定。
平成30年7月4日(水曜日)
要調査 WebAPI マニュアル POI
WebAPI マニュアル
Yahoo! Japan News等
要設定 マイロケーション!!
Privacy – Location Always Usage Description YourAppName would like to use your location.
Privacy – Location When In Use Usage Description YourAppName would like to use your location.
新機能!!クラスタリング等
MKMarkerAnnotationViewについては、これから
それ以外は完動!!
iOS 11で大幅に強化されたMapKit
swift4.1 完動
サンプル クラスタリング Tandmへのリンク等有り
IOS 11 で MapKit の新機能