One Quickie


Finding the span of a paragraph (NSTextView->General)
The NSString paragraphRangeForRange: method gives you the span of a paragraph. If you're using the text architecture, you need to get the string from the text storage. This chunklet shows the paragraph span for the current selection:
    NSRange selectedRange = [textview selectedRange];
    NSTextStorage *storage = [textview textStorage];
    effectiveRange = [[storage string] paragraphRangeForRange: selectedRange];



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com