Developer Area

Changeset 630

Show
Ignore:
Timestamp:
01/11/10 14:14:29 (2 months ago)
Author:
henri
Message:

Made row size height dynamic

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • apps/iphone/my.tel/trunk/Classes/KeywordViewController.m

    r622 r630  
    168168 
    169169- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 
    170         //      NSDictionary *uiItem = [[uiArray objectAtIndex:indexPath.row] retain]; 
    171         //      NSString *secondaryString = [uiItem objectForKey:@"secondaryString"]; 
    172         //      CGSize constrainedSize = CGSizeMake([UIScreen mainScreen].bounds.size.width - 40, 200); 
    173         //      CGSize expectedSize = [secondaryString sizeWithFont:[UIFont systemFontOfSize:12] 
    174         //                                                                        constrainedToSize:constrainedSize 
    175         //                                                                                lineBreakMode:UILineBreakModeWordWrap]; 
    176         //      return expectedSize.height+26; 
    177         CGFloat sizeForFiveLines = ([[KeywordCell labelFont] pointSize] + 4) * 7; 
    178         return sizeForFiveLines; 
     170        CGFloat rowSize = 30;   // title + borders 
     171        CGSize constrainedSize = CGSizeMake([UIScreen mainScreen].bounds.size.width - 50, 200); 
     172        NSDictionary *uiItem = [[uiArray objectAtIndex:indexPath.row] retain]; 
     173        NSString *primaryValue = [uiItem objectForKey:@"value"]; 
     174        rowSize += [primaryValue sizeWithFont:[UIFont systemFontOfSize:12] 
     175                                                   constrainedToSize:constrainedSize 
     176                                                        lineBreakMode:UILineBreakModeWordWrap].height; 
     177        NSString *secondaryString = [uiItem objectForKey:@"secondaryString"]; 
     178        rowSize += [secondaryString sizeWithFont:[UIFont systemFontOfSize:12] 
     179                                                                          constrainedToSize:constrainedSize 
     180                                                                                  lineBreakMode:UILineBreakModeWordWrap].height; 
     181        return rowSize; 
    179182} 
    180183 
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us