TableViewCell获取不到控件

zioc2014 2014-06-04 12:25:36

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DetailItem"];

//Get Controls
UILabel *labelType = (UILabel *)[cell viewWithTag:1001];
UILabel *labelDate = (UILabel *)[cell viewWithTag:1002];
UILabel *labelAmount = (UILabel *)[cell viewWithTag:1003];
UIImageView *imageViewIcon = (UIImageView *)[cell viewWithTag:1005];


Tag都设置了,能取到ImageView,3个label都取不到,调试的时候都是nil。

布局是这样的
...全文
197 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shuai265 2016-03-07
  • 打赏
  • 举报
回复
引用 4 楼 鹤岗内小子的回复:
楼主,你是怎么解决的,我也遇到了
你解决了吗?我也遇到同样问题,是不是Xcode有bug
sunzsh 2014-12-24
  • 打赏
  • 举报
回复
楼主,你是怎么解决的,我也遇到了
ArcRain 2014-06-04
  • 打赏
  • 举报
回复
cell.contentView viewWithTag 因为你的控件是加在contentView上的
zioc2014 2014-06-04
  • 打赏
  • 举报
回复
引用 1 楼 dream238 的回复:
cell.contentView viewWithTag 因为你的控件是加在contentView上的
已解决。tag标记错了
zioc2014 2014-06-04
  • 打赏
  • 举报
回复
引用 1 楼 dream238 的回复:
cell.contentView viewWithTag 因为你的控件是加在contentView上的
还是不行。而且也不能解释为什么imageview就获取到了

29,027

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧