Note that there are some explanatory texts on larger screens.

plurals
  1. POuitableviewcell textlabel too long and push detailtextlabel out of view
    primarykey
    data
    text
    <p>When i'm using UITableViewCellStyleValue1, i got a long string of textLabel, and somehow the detailTextLabel got push out from the view.</p> <p>When i shorted my textLabel text, then i can see the detailTextLabel's text.</p> <p>Is there anyway to limit the width of textLabel in the above style so that it will truncate the textLabel with it's too long?</p> <p>My code is:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.lineBreakMode = UILineBreakModeTailTruncation; //---get the letter in each section; e.g., A, B, C, etc.--- NSString *alphabet = [self.currencyNameIndex objectAtIndex:[indexPath section]]; //---get all states beginning with the letter--- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", alphabet]; self.currencyList = [self.keyCurrencyName filteredArrayUsingPredicate:predicate]; if ([self.currencyList count] &gt; 0) { NSString *currencyName = [self.keyCurrencyName objectAtIndex:indexPath.row]; cell.textLabel.text = currencyName; NSString *currencyCode = [self.valueCurrencyCode objectAtIndex:indexPath.row]; cell.detailTextLabel.text = currencyCode; } return cell; } </code></pre> <p>so my currency name will be a long one on some entry.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload