开发者

Why I cant be able to change the UITableViewCell detailTextLabel's frame (just the label's position)?

I am having a table view with default UITableViewCell of style UITableViewCellStyleValue2. I开发者_开发知识库 just want to move detailTextLabel few pixels to the right. I know it makes no sense to adjust its width and height :). I am trying to set detailTextLabel's frame with my x and y value. But its not affecting the its frame. I prefer to use default UITableViewCell, in this case, over a customized cell because the default UITableViewCell automatically manages the text alignment and centering of the labels..

  1. How to change UITableViewCell detailTextLabel's frame?
  2. Am I allowed to change its frame?

Thanks everyone..


You said you want to change the frame of detailTextLabel without using the custom cell implementation then the answer to your questions will be :-

  1. It is not possible
  2. No, it is not possible

For that you have to use custom cell , and add probably a textview or a label to the cell's contentView according to your needs


They have the default size with the table view cell.You can do the custom implementaion.Here is the example I am giving to you

UILabel *productNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 35, 60,20 )];
    productNameLabel.textColor = [UIColor whiteColor];
    productNameLabel.backgroundColor=[UIColor clearColor];
    productNameLabel.text=@"Name";
    [cell.contentView addSubview:productNameLabel];
    [productNameLabel release];

Hope this will help you.Try to use the custom implementaion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜