ios - 了解 TableView 中的 localizedTitle 和 localizedDescription

标签 ios swift uitableview in-app-purchase skproduct

我目前正在实现应用内购买机制,但有三件事我没有完全理解。

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

什么是 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
}

最佳答案

关于ios - 了解 TableView 中的 localizedTitle 和 localizedDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38862639/

相关文章:

c++ - 如何处理头文件中的非ARC代码?

ios - 您如何管理 iOS 项目中的 View 标签?

ios - Swift (iOS) - PickerView 未被 HTTP GET 请求填充

ios - 以编程方式更改现有的 UIBlurEffect UIBlurEffectStyle?

ios - 确实出现了 UIWebView 重绘 View ,我该如何防止这种情况发生?

ios - 自定义表格 View 的 ScrollView

ios - 如何将 Wavefront OBJ 文件转换为具有模型 I/O 的 SCNNode

ios - Braintree - 嵌入式用户界面 - Apple Pay - Swift 3

ios - 如何在 UITableViewCell 上突出显示 UIButton

iOS UITableView CheckMark 出现在每一行