Visible range in UITextView
Visible range in UITextView
- Subject: Visible range in UITextView
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Wed, 14 Aug 2013 14:14:07 +0700
I have a TextView which can be messed up via buttons (e.g. set a new font) but which should keep showing the same range.
Like:
- (void)applyNewFont: (UIFont *)f
{
NSRange visibleCharacterRange = self.textView.visibleRange;
self.textView.font = f;
[ self.textView scrollRangeToVisible: visibleCharacterRange];
}
The problem: I cannot find anything like visibleRange or visibleRect.
Any workarounds?
Gerriet.
P.S. On OS X I would do:
NSRect visibleRect = [ self.textView visibleRect ];
NSRange visibleGlyphRange = [ layoutManager glyphRangeForBoundingRect: visibleRect inTextContainer: textContainer ];
NSRange visibleCharacterRange = [ layoutManager characterRangeForGlyphRange: visibleGlyphRange actualGlyphRange: NULL ] ;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden