【发布时间】:2015-06-24 21:18:30
【问题描述】:
我是 iphone 应用程序开发的新手。
我目前有一个表格视图,但想用我自己的新闻故事填充它,知道我该怎么做吗?
目前我有以下:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! NewsTableViewCell
// Configure the cell...
if indexPath.row == 0 {
cell.postImageView.image = UIImage(named: "premier-league")
cell.postTitleLabel.text = "Join our league"
cell.authorLabel.text = "Paul"
cell.authorImageView.image = UIImage(named: "author")
} else if indexPath.row == 1 {
cell.postImageView.image = UIImage(named: "example2")
cell.postTitleLabel.text = "Fixtures for the coming season"
cell.authorLabel.text = "Paul"
cell.authorImageView.image = UIImage(named: "author")
} else {
cell.postImageView.image = UIImage(named: "example3")
cell.postTitleLabel.text = "New App for the new season"
cell.authorLabel.text = "Paul"
cell.authorImageView.image = UIImage(named: "author")
}
return cell
}
【问题讨论】:
-
对不起,我没有解释得很好。我想用来自 wordpress 的 rss 提要填充表格,以包含上述格式的图像。
标签: ios objective-c iphone swift tableview