Adding exclusion paths to multiple text views

左心房为你撑大大i 提交于 2019-12-06 01:55:31

I guess in retrospect this is obvious, but the solution I arrived at is to add exclusion paths to each new NSTextContainer right after you allocate the container but before doing anything else. i.e.

NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:columnSize];
textContainer.exclusionPaths = @[exclusionPath];
[manager addTextContainer: textContainer];

rather than:

NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:columnSize];
[manager addTextContainer: textContainer];
textContainer.exclusionPaths = @[exclusionPath];

which causes the app to become unresponsive.

Simple when you know how. This only applies to multi-column, multi-page layouts where you're creating multiple text containers and views and breaking up the glyphs to fit properly. If you're only adding one exclusion path to one view, seems like you can add the exclusion path anywhere.

This is Very easy and helpful thing for ImageWrapping in RichText. but One should keep thing in Mind. a day ago I tried this one and found same code working differently for iOS 7.0 and iOS 7.1

The Blinking Cursor of TextView appears at different place until there is no text in UITextView.

I wrote this code.

UIBezierPath* exclusionPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 38, 21)];
_txtViewMessage.textContainer.exclusionPaths  = @[exclusionPath];

and Found Following result in iOS 7.1 and iOS 7.0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!