【iOS】Illegal Configuration: The Label outlet from the ViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

报错:Illegal Configuration: The Label outlet from the ViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

产生原因:tableview里面的label是动态的,而用storyboard那样拖动绑定过来的outlet是静态的,所以不能采用这种方法来绑定。应该采用如下方法:

首先给label设置一个Tag,比如105

snip20161208_198

然后在代码中使用viewWithTag的方法访问: