为了账号安全,请及时绑定邮箱和手机立即绑定

怎么给cell里有tag的控件赋值?

  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{

        

       

            let cell = tableView.dequeueReusableCellWithIdentifier("tonggaocell", forIndexPath: indexPath) as! UITableViewCell //1

            

            let tonggao = tonggaos[indexPath.row] as TongGaoModel //2

            

            let nameLabel = cell.viewWithTag(101) as? UILabel

            nameLabel!.text = tonggao.title

        

        

        return cell

     }


   nameLabel!.text = tonggao.title

   返回值一直是nil,程序崩溃

正在回答

0 回答

举报

0/150
提交
取消
使用Swift开发iOS8 App实战
  • 参与学习       62602    人
  • 解答问题       553    个

通过苹果最新Swift语言开发iOSApp,从零开始学习iOS的开发

进入课程

怎么给cell里有tag的控件赋值?

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号