title: How to tell when a UILabel will be truncated an/or its line break position will change
body: <p>I have a multi-line <code>UILabel</code> (<code>numberOfLines</code> = 0). It's width can change at runtime, and sometimes this leads to truncation and/or re-wrapping. Some examples illustrate this best:</p>
  
  <p><strong>Example 1: the reduction in width leads to a different line break point</strong></p>
  
  <p><img src="https://i.stack.imgur.com/mILEq.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/Gvwlt.png" alt="enter image description here"></p>
  
  <p><strong>Example 2: the reduction in width leads to truncation</strong></p>
  
  <p><img src="https://i.stack.imgur.com/4OHuN.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/H5aTV.png" alt="enter image description here"></p>
  
  <p><strong>Example 3: the reduction in width leads to both truncation and a different line break position</strong></p>
  
  <p><img src="https://i.stack.imgur.com/klGcF.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/IL5t9.png" alt="enter image description here"></p>
  
  <p><strong>Example 4: the reduction in width does not have any effect on truncation or line break position</strong></p>
  
  <p><img src="https://i.stack.imgur.com/I6XtI.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/2sXLu.png" alt="enter image description here"></p>
  
  <p>Since this change in formatting can be quite jarring, I intend to mask it behind some animation (probably a fade in/fade out). However, the first hurdle is identifying <strong>when</strong> I need to do this. I don't want to apply the animation whenever the label re-sizes - only when it will cause a change in either truncation or line break positions.</p>
  
  <p>How might I test this? The test should return YES for example 1, 2, and 3, but NO for example 4.</p>
  
  <p>Note: the resizing will never alter the number of lines in my example.</p>
  
  <p>Note 2: if anyone has some better tags related to text formatting I'd love to know them - feel free to edit.</p>
  
  <p>Note 3: if you are interested in seeing this behavior accomplished, try Apple's mail.app on the iPhone. When viewing the inbox, swipe an email and watch the summary line fade-in/out as it re-wraps and/or truncates (but not when it doesn't need to).</p>