SBクリエイティブ

正誤情報

『UIKit&Swiftプログラミング』正誤情報

2015.07.06
対象書籍
UIKit&Swiftプログラミング

本書内の記載のうち、以下の項目で誤りがありました。
修正内容を提示させていただきます。
ご迷惑をおかけいたしましたこと、つつしんで詫び申し上げます。

※初版第1刷


p.201 競合の解消(Sample5-3-9 iCloudDemo)

■誤
func iCloudDocumentDidChange(notification: NSNotification) {
    if self.document.documentState & .InConflict == .InConflict {
        NSFileVersion.removeOtherVersionsOfItemAtURL(
            self.documentURL, error: nil)

        let conflicts = NSFileVersion
            .unresolvedConflictVersionsOfItemAtURL(
            self.documentURL) as [NSFileVersion]
        for fileVersion in conflicts {
            fileVersion.resolved = true
        }
    }
}

■正
func iCloudDocumentDidChange(notification: NSNotification) {
    if self.document.documentState & .InConflict == .InConflict {
        NSFileVersion.removeOtherVersionsOfItemAtURL(
            self.document.fileURL, error: nil)

        if let conflicts = NSFileVersion
            .unresolvedConflictVersionsOfItemAtURL(
            self.document.fileURL) as? [NSFileVersion] {

            for fileVersion in conflicts {
                fileVersion.resolved = true
            }
        }
    }
}

p.210 Editingメニューを表示する実装(Sample5-4-3 PastebordDemo)
■誤
// MARK: – Observerアクション

func menuDidHide(notification:NSNotification) {
    println(“menuDidHide”)

    // targetをnilにしてアクションメッセージを送る手法を
    // Nil-targeted Actionと呼びます。
    // この場合、アクションメッセージはまずFirst Responderに
    // 送られ、First Responderがアクションを処理できない場合、
    // 処理できるResponderが見付かるまでResponderチェーンを
    // 探索します。
    UIApplication.sharedApplication().(“resignFirstResponder”,
        to: nil, from: nil, forEvent: nil)
}

■正
// MARK: – Observerアクション

func menuDidHide(notification:NSNotification) {
    println(“menuDidHide”)

    // targetをnilにしてアクションメッセージを送る手法を
    // Nil-targeted Actionと呼びます。
    // この場合、アクションメッセージはまずFirst Responderに
    // 送られ、First Responderがアクションを処理できない場合、
    // 処理できるResponderが見付かるまでResponderチェーンを
    // 探索します。
    UIApplication.sharedApplication().sendAction(
        “resignFirstResponder”, to: nil, from: nil, forEvent: nil)
}


p.245 遷移先のWebViewを持ったViewControllerの実装(Sample6-1-4 CustomViewDemo)

■誤
if let path = pdfPath
    ; url = NSURL(fileURLWithPath: path) {
        let req = NSURLRequest(URL: url)
        _webView.loadRequest(req)
}

■正
if let path = pdfPath
    , url = NSURL(fileURLWithPath: path)
{
    let req = NSURLRequest(URL: url)
    _webView.loadRequest(req)
}

p.314 テキストフィールド付きのアラート(Sample8-1-4 AlertDemo)
■正
// .Cancelは右側に表示されます。

■誤
 // Cancelは追加する順序に関わらず左側に表示されます。

この記事をシェアする