Why can't I change the structure of the UITableViewCell detailTextLabel (only label position)?

I have a table view with UITableViewCell by default UITableViewCellStyleValue2. I just want to move the detailTextLabel a few pixels to the right. I know that it makes no sense to adjust its width and height :). I am trying to set the detailTextLabel frame with my x and y values. But this does not affect its structure. I prefer to use the default UITableViewCell in this case with the configured cell, because the default UITableViewCell automatically controls text alignment and label centering.

  • How to change UITableViewCell detailTextLabel frame?
  • Can I change its frame?

Thanks to everyone ..

+4
source share
2 answers

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

  • Impossible
  • No, It is Immpossible

To do this, you need to use a custom cell and add, possibly, a text view or a shortcut to the cellView content element according to your needs.

+6
source

They have a default size with a table view cell. You can do custom implementation. Here is an example that I give 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 helps you. Try using a custom implementation.

+2
source

Source: https://habr.com/ru/post/1334732/


All Articles