2011-08-05 58 views

回答

1

要么你应该使用两个UILables,或者您可以使用OHAttributedLabel绘制NSAttributedString ..

编辑:

您可以使用动态改变大小的UILabel,

CGSize expectedLabelSize = [titleLabel.text sizeWithFont:titleLabel.font]; 
titleLabel.frame = CGRectMake(xBase, yBase, expectedLabelSize.width, expectedLabelSize.height); 
+0

感谢..这真的帮助 – Jack

+0

@jack欢迎:) – KingofBliss

0

插孔 使用cell.textLabel.textcell.textLabel.DetailText .. 这些是一个单元格中的两个标签..

0

对于每个标签创建字体并应用于该标签的font属性。

+ (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize 
+0

但标签的尺寸是固定的吧??我想要显示与iPhone地址簿中相同的内容。 – Jack

0

制作自定义的UITableViewCell。

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
     if (cell == nil) { 
      cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; 
     } 

     //Initialize String for Displaying 
     //NSString *str = 

     UILabel *lbl; 
     if ([cell.contentView.subviews count] == 0) { 

      //Label alloc and init with frame 
      //lbl = [[UILabel] alloc] initWithFrame:CGRectMake(x,y,width,height)]; 

      //Cofigure Label (text, font, etc.) 
      lbl.text = str; 
      //lbl.font = font;  

      //Add subview 
      [cell.contentView addSubview:lbl]; 

      //Release 
      [lbl release]; 
     } 
     else { 
      lbl = [cell.contentView.subviews objectAtIndex:0]; 

      lbl.text = str; //Do only set variable value. 
     } 

     return cell; 
    } 
+0

谢谢.. DIS给了我一些想法..! – Jack