将 UILabel 添加到 UITableViewCell 的detailTextLabel
在我的由分组 tableView 组成的应用程序中,detailTextLabel 显示通过日期选择器输入的日期。我使用这个日期从网络服务检索数据。我想要做的是将UILabels 添加到单元格的detailTextLabel 中,以便我可以访问标签的文本属性以获取日期并向网络服务发送请求。我尝试像这样向详细文本标签添加标签,
cell.detailTextLabel = self.fromDate //fromDate is an instance of UILabel;
但它显示错误...
我该如何解决这个问题
In my app that consist of a grouped tableView,the detailTextLabel displays dates entered through a datepicker. and i use this dates to retrieve data from webservice. What i want to do is to add UILabels to detailTextLabel of the cells so that i can access the label's text property to get the dates and send request to webservice. i tried adding label to the detailTextLabel like this
cell.detailTextLabel = self.fromDate //fromDate is an instance of UILabel;
But its showing me error...
How can i fix this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该设置 cell.detailTextLabel.text 来修改其内容,并可能更改 cell.detailTextLabel 的布局,但不要尝试为其分配另一个 UILabel。
您可能想添加自己的标签作为子视图,然后按照以下方式执行操作
You should set cell.detailTextLabel.text to modify it's contents, and possibly change the layout of cell.detailTextLabel, but not try to assign another UILabel to it.
You might want to add your own label as a subview, then do something along the lines of