
ページ |

: |

誤 |

 |

正 |
 |
42 |
: |
●表4.5の中の「indexForKey」の説明
末尾に要素を追加 |
 |
要素のインデックスを取得 |
 |
134 |
: |
●図7.16のキャプション
結果表示ビューの制約 |
 |
Toolbarの制約 |
 |
145 |
: |
●リスト 7.5 の22行目
mode = .Map
の行が文法エラーとなります。 |
 |
後述しているP.168 のリスト7.33 に従って、ViewController.swiftファイルを編集してください。
ViewModeクラスとmode変数の宣言が追加され、文法エラーが解消されます。 |
 |
145 |
: |
●本文下から9行目のセンテンス
MapViewControllerとTableViewControllerのインスタンスのルートビュー(mapViewController.view及びtableViewController.view)を、それぞれcontainerのサブビューとして登録しています(11 〜12行目)。 |
 |
MapViewControllerとTableViewControllerのインスタンスのルートビュー(mapViewController.view及びtableViewController.view)を、それぞれcontainerのサブビューとして登録しています(18 〜19行目)。 |
 |
150 |
: |
リスト7.9 ShopModelクラス |
 |
リスト7.9 MyAnnotationクラス |
 |
150 |
: |
●リスト 7.9 の17行目と21行目
「NSString!」は、「String!」が正しい。
17 func title() -> NSString! {
21 func subtitle() -> NSString! { |
 |
17 func title() -> String! {
21 func subtitle() -> String! {
|
 |
157 |
: |
●リスト7.22の12行目
12 return shopList.count |
 |
12 return shopInfoList.count |
 |
158 |
: |
●リスト 7.22 の 28行目
28 let shopData = shopList[indexPath.row] |
 |
28 let shopData = shopInfoList [indexPath.row] |
 |
164 |
: |
●「7.12.1 店舗情報画面への遷移」の本文
店舗情報画面の実装ができましたので、その画面への遷移処理を実装しましょう(リスト7.28)。 |
 |
店舗情報画面の実装ができましたので、その画面への遷移処理を実装しましょう(リスト7.28)。
ViewControllerの変数宣言に、shopList変数の宣言(01〜03行)を追加した後、presentShopViewController()を実装します。 |
 |
164 |
: |
●リスト7.28の冒頭
01 func presentShopViewController(index: Int) {
02 // shopListがない、指定のindexがshopListに含まれる要素数を越える場合は何もしない |
 |
冒頭に次の3行を追加。
01 var tableViewController: TableViewController!
02
03 var shopList: [ShopModel]!
……
04 func presentShopViewController(index: Int) {
05 // shopListがない、指定のindexがshopListに含まれる要素数を越える場合は何もしない
(以下、行番号は「+3」でずれていきます。)
|
 |
165 |
: |
●本文上から4行目
Controller位置情報取得処理に必要なプロパティを宣言しましょう(リスト7.29)。 |
 |
Controller位置情報取得処理に必要なプロパティ宣言と位置情報の取得開始処理を行いましょう(リスト7.29)。 |
 |
165 |
: |
リスト7.29 位置情報取得処理用のプロパティ宣言
01 class ViewController: UIViewController, CLLocationManagerDelegate {
……
02 var mapViewController: MapViewController!
03 var tableViewController: TableViewController!
04
05 var locationManager: CLLocationManager!
06 var currentLocation: CLLocation?
…… |
 |
リスト7.29 位置情報取得処理用のプロパティ宣言と位置情報取得開始処理
01 class ViewController: UIViewController, CLLocationManagerDelegate {
……
02 var mapViewController: MapViewController!
03 var tableViewController: TableViewController!
04
05 var locationManager: CLLocationManager!
06 var currentLocation: CLLocation?
……
07 override func viewDidLoad() {
……
08 // 地図表示が前面に出ているため、現在の表示モードを地図に設定
09 mode = .Map
10
11 // 位置情報取得開始
12 locationManager = CLLocationManager()
13 locationManager.delegate = self
14 locationManager.
startUpdatingLocation()
…… |
 |
165 |
: |
●下から4行目
者は、位置情報取得が許可されていない場合や、屋内にいる場合など、位置情報を取得できないことがありうるためです。
次に、iOS 8に対応した位置情報取得の許可を求めるダイアログを表示する処理を記述し
ます(リスト7.30)。 |
 |
者は、位置情報取得が許可されていない場合や、屋内にいる場合など、位置情報を取得できないことがありうるためです。
viewDidLoad()に位置情報取得の開始処理(11〜14行)を追加します。LocationManager()のインスタンスを生成してlocationManagerに格納します。そして、locationManagerのdelegateにselfを設定しておき、startUpdatingLocation()で位置情報取得を開始します。
次に、iOS 8に対応した位置情報取得の許可を求めるダイアログを表示する処理を記述します(リスト7.30)。 |
 |