【问题标题】:Understanding localizedTitle and localizedDescription in TableView了解 TableView 中的本地化标题和本地化描述
【发布时间】:2016-08-10 00:56:50
【问题描述】:

我目前正在实施应用内购买机制,有三件事我不完全了解。

在下面的 tableView 中,我使用单例类从应用风暴中检索产品,我不确定它们到底做了三件事...

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
}

【问题讨论】:

  • 阅读SKProduct 的文档以了解localizedTitlelocalizedDescription 是什么。
  • 阅读 Swift 编程语言的基础知识以了解 as! SKProduct 的含义。
  • 感谢您为我指明了正确的方向,我查看了错误的文档...developer.apple.com/reference/foundation/nserror/…

标签: ios swift uitableview in-app-purchase skproduct


【解决方案1】:
猜你喜欢
  • 2022-09-24
  • 2018-09-26
  • 1970-01-01
  • 2014-04-15
  • 2015-01-26
  • 1970-01-01
  • 2013-06-27
  • 2012-03-25
  • 1970-01-01
相关资源
最近更新 更多