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 detailTex开发者_如何学CtLabel 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
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
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(160.0f,23.0f,150.0f,20.0f)];
lbl.textAlignment = UITextAlignmentRight;
lbl.font = [UIFont fontWithName:@"Arial" size:14.0f];
lbl.textColor = [UIColor lightGrayColor];
lbl.text = [@"Ref.No. " stringByAppendingString:refno];
[cell addSubview:lbl];
精彩评论