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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to