2016-08-10 20 views
1

我目前正在實施應用內購買機制,並且有三件事情我沒有完全理解。瞭解TableView中的localizedTitle和localizedDescription

在下面的tableView我使用一個單獨的類檢索的產品從App風暴有三件事,我不知道他們究竟做...

是什麼as! SKProduct辦?

localizedTitlelocalizedDescription做什麼?

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cell = UITableViewCell(style: .Subtitle, reuseIdentifier: "reuseIdentifier") 
    // what does `as! SKProduct` do 
    let product = IAPManager.sharedInstance.products.objectAtIndex(indexPath.row) as! SKProduct 

    // what does localizedTitle do? 
    cell.textLabel!.text = product.localizedTitle 
    // what does localizedDescription do? 
    cell.detailTextLabel!.text = product.localizedDescription 

    return cell 
} 
+1

閱讀文檔'SKProduct'來了解'localizedTitle'和'localizedDescription'是什麼。 – rmaddy

+1

閱讀Swift編程語言的基礎知識,瞭解「as! SKProduct'的意思。 – rmaddy

+0

謝謝你指點我在正確的方向我正在看錯誤的文檔... https://developer.apple.com/reference/foundation/nserror/1414418-localizeddescription –

回答

相關問題