使用Xcode 6.3 beta时,Parse/Swift存在问题
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath , object: PFObject) -> PFTableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! secTableViewCell
if cell == nil
{
cell = secTableViewCell(style: UITableViewCellStyle.Default , reuseIdentifier: "cell")
}
// Configure the cell...
cell.title.text = (object["exams"] as! String)
cell.img.image = UIImage(named: "109.png")
return cell
}
Run Code Online (Sandbox Code Playgroud)
错误指向
if cell == nil
{
cell = secTableViewCell(style: UITableViewCellStyle.Default , reuseIdentifier: "cell")
}
Run Code Online (Sandbox Code Playgroud)
二元运算符'=='不能应用于cell类型和nil的操作数"
我希望UILabel从顶部开始,即使文本很短,似乎
NSTextAlignment不起作用
cell.textContent.text = comments[indexPath.row]
cell.textContent.textAlignment =
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
//post's section == 0
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCellWithIdentifier("postCID", forIndexPath: indexPath) as! postCell
cell.usernameLabel.text = "Steve Paul Jobs"
cell.time.text = "9:42 PM"
cell.commentsLabelCount.text = "12 Comments"
cell.textContent.text = "Return the number of rows in the sectioReturn the number of rows in the sectioReturn the number of rows in the sectioReturn the number of rows in the sectioReturn …Run Code Online (Sandbox Code Playgroud)