I have a UILabel next to a UIImage where I want the UILabel to be show truncated "..." if it starts to overlap with the neighboring UIImage.
Text is behind the UIImage when i want it to just truncate:
I thought the issue is the content compression but I set the UILabel's content compression resistant priority horizontal to 250 and the UIImage to 1000. This only hides the UILabel behind the UIImage.
*This is inside a table cell. I'm not using the default table cell view because i intend to customize it further.
从UILable到UIImage的尾随添加常量值5,并且关系小于和等于(<=)。
Three things can be done.
Add constraint between:
1) UIImage and the table cell (the container view)
2) UILabel and the UIImage
3) and finally one between tableCell and UILabel
This way you will have your UILabel stretching from the left side of the cell all the way to the image view, and truncate the text that doesnt fit into the label.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.