lineBreakBeforeIndex:withinRange:
指定した範囲の指定した番号から行分割文字の位置を返します
-(unsigned int)lineBreakBeforeIndex:(unsigned)index: withinRange:(NSRange)aRange:
解説
指定した範囲(aRange)の指定した番号(index)から行分割文字の位置を返します。
英語等では単語の切れ目のスペースなどが行分割文字に当たります。
返り値
( unsigned int )
整数値
引数
( unsigned )index
番号
( NSRange )aRange
範囲
フレームワーク
ApplicationKit
クラス
NSAttributedStringAdditions
Instance Methods
使用可能
10.1
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSMutableAttributedString *aString = [[NSMutableAttributedString alloc] initWithString:@"That is a beautiful moon."]; //NSMutableAttributedString *aString; //[aString setAttributedString:[myOutlet attributedStringValue]]; unsigned lb = [aString lineBreakBeforeIndex:1 withinRange:NSMakeRange(0,25)]; NSLog([NSString stringWithFormat:@"%d",lb]); [[myOutlet textStorage] appendAttributedString:aString]; NSLog([aString description]); (lb == NSNotFound) ? NSLog(@"NSNotFound") : NSLog(@"NO"); } @end