小编Jam*_*rty的帖子

tableviewcell"二元运算符'=='的Parse/Swift问题不能应用于cell类型和nil的操作数"

使用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的操作数"

xcode tableviewcell ios parse-platform swift

10
推荐指数
1
解决办法
1万
查看次数

Swift:将UILabel文本对齐在顶部而不是中间

我希望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)

text-alignment uilabel ios swift

8
推荐指数
4
解决办法
3万
查看次数