问题
In my application I parsed the data through NSXMLParser and made separate class to store that data from which i usually display the data. Everything works fine in simulator except the the title which is display in table cell with image. Images appears properly but the title not appear properly.
This is my code:-
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"TableCell3" owner:self options:NULL];
cell = nibLoadedCell;
}
NewsInfo *aNewsInfo = [appDelegate.newsArray objectAtIndex:indexPath.row];
titleLabel.text = aNewsInfo.title;
imageLabel.image = aNewsInfo.smallImageData;
return cell;
}
and in this way i configured my TableCell3.xib
Now i want my title data in 2 rows in label of the TableCell3. I already used both the way through xib attributes settings or through code. Code which i used instead of this xib attributes settings are:-
titleLabel.lineBreakMode = UILineBreakModeWordWrap;
titleLabel.numberOfLines = 2;
titleLabel.text = aNewsInfo.title;
Now Can any one help me to figure out this prob i want to display my title in two rows of the table view cell.
Thanks in Advance.
My Data is showing in this way...![enter image description here][2]
So i want to display this title fully it show's partially right now... i want to display in two lines...
回答1:
My guess is that you need to enlarge the label height.
Maybe the label height i not large enough to display 2 lines of text and that's could be the reason that you see only 1 line.
in interface builder try to enlarge the label height.
and maybe i am wrong ?
Good luck Shani
回答2:
Adjust frame of an UiLabel to have more space for two lines or decrease font size.
来源:https://stackoverflow.com/questions/6192025/problem-in-displaying-properly-in-tableview-cell-by-using-label