views:

1208

answers:

1

I am building a UITableViewCell. I am using the style UITableViewCellStyleSubtitle for my table view cell. In the textLabel of the cell I have data that can require a wrap. So to accomodate, I want to move down the detailTextLabel so that the wrapped text isn't covered by the text in the detailTextLabel. I am attempting the following:

CGPoint tempPoint = tableViewCell.detailTextLabel.center;
tempPoint.y += 100;
tableViewCell.detailTextLabel.center = tempPoint;

I have tried similar approaches with the frame of the label, but I could not get it to move. When I log the y of the center point before and after, I always see it start as 0 and then it is just 100 afterwards. I am using the %f flag in NSLog to view the value. This all occurs in the function:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

Any help would be great.

+2  A: 

I subclassed UITableViewCell and implemented the - (void)layoutSubviews method. I moved the label in that method.

Brian
I had to do the same, in order to achieve this.
Brad Larson