theDC
theDC

Reputation: 6484

Cell's accessory keeps truncating UILabel

I just wonder why a UILabel in UICell gets truncated despite the fact that it would actually fit there.

enter image description here

I know that accessory indicator takes some space but this is not the point, from what I can see in my storyboard the uilabel would fit there easily. My constraints aren't much stark - There is no trailing space set, just the leading space and vertical alignment.

enter image description here

Do you have any idea what can cause the truncation of the UILabel? I mean, I know that truncation is caused by the Line Breaks parameter but it's not the point, what is wrong with this free space next to the label that makes it want to break?

Thanks in advance

EDIT:

this the piece of code where I set the color, maybe this is something with this frame to achieve gradient color?

cell!.cellWorkoutLabel.text = workout.title
    cell!.cellWorkoutLabel.sizeToFit()
    var frameCell = CGRectMake(0,0, 500, 500)
    if(indexPath.row%2==0){
        cell!.backgroundColor = GradientColor(UIGradientStyle.Radial, frameCell, colors)
    }
    else if(indexPath.row%2 != 0)
    {
       cell!.backgroundColor = GradientColor(UIGradientStyle.Radial, frameCell, colors)
    }

Upvotes: 3

Views: 171

Answers (1)

Dharmbir Singh
Dharmbir Singh

Reputation: 17535

You need to set trailing space to the label because bydefault it is taking width that's why its happening . So you need to set it manually.

Upvotes: 2

Related Questions