Skip navigation.
 
mlRe: NSLayoutManager and avoiding widows and orphans
FROM : Martin Wierschin
DATE : Wed Nov 07 02:24:04 2007

Hi Keith,

> So, next I tried waiting until all layout is complete and then 
> enumerating through the text containers, checking for a widow or 
> orphan at the end of each one, adjusting the frame and then forcing 
> layout. But again, if a page gets added because of this, we hit 
> problems - bounds and run storage exceptions, and problems caused 
> by adding a text container whilst enumerating through the text 
> containers.


Do you trigger this frame adjusting from the NSLayoutManager delegate 
methods? In my experience it is not safe to modify text container 
geometry/size from this callback. Try this and see if it fixes your 
crash: after you detect that layout has completed schedule your 
fixing code via "performSelector:withObject:afterDelay:".

~Martin

Related mailsAuthorDate
mlNSLayoutManager and avoiding widows and orphans Keith Blount Nov 7, 01:39
mlRe: NSLayoutManager and avoiding widows and orphans Martin Wierschin Nov 7, 02:24
mlRe: NSLayoutManager and avoiding widows and orphans Keith Blount Nov 8, 00:06
mlRe: NSLayoutManager and avoiding widows and orphans Ross Carter Nov 9, 17:32