How to set both cell.textLabel and cell.detailTextLAbel in case when we are choosing UITableViewCellStyleValue1 effectively?
I am trying to fit both cell.textLabel and cell.de开发者_如何学运维tailTextLabel in same line while choosing UITableViewCellStyleValue1. In my case a few times the detailText is going off the cell and is not visible at all. PLease help!!!
One way is that you can set the adjustsFontSizeToFitWidth to YES to let the label resize the font size to fit the text in its bounds. If you do this, you can also limit the reducing of font size to some size by setting the minimumFontSize property.
Another way is to set numberOfLines property. Setting 0 means no limit, and the label will automatically change its height to display the text in multiple lines. In this case, you should also return the required height from heightForRowAtIndexPath: method. Otherwise, the label will be clipped to the cells height.
精彩评论