fixAttributesInRange:
指定した範囲の文字の属性をなくします
-(void)fixAttributesInRange:(NSRange)aRange:
解説
指定した範囲の文字の属性をなくします。
直前の文字の属性が適用されます。
aRangeがレシーバの範囲を越えればNSRangeExceptionを起こします。
返り値
( void )
なし
引数
( NSRange )aRange
範囲
フレームワーク
ApplicationKit
クラス
NSMutableAttributedString Additions
Instance Methods
使用可能
10.0
参照
- fixAttachmentAttributeInRange:
- fixFontAttributeInRange:
- fixParagraphStyleAttributeInRange:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSMutableAttributedString *maStr =[[[NSMutableAttributedString alloc] initWithString:@"AttributedString" attributes:nil] autorelease]; //スタイル指定 [maStr applyFontTraits:( NSBoldFontMask | NSItalicFontMask ) range:NSMakeRange(2,5)]; [myOutlet setAttributedStringValue:maStr]; } - (IBAction)fix:(id)sender { NSMutableAttributedString *maStr1 =[[[NSMutableAttributedString alloc] initWithString:@"" attributes:nil] autorelease]; [maStr1 appendAttributedString:[myOutlet attributedStringValue]]; [maStr1 fixAttributesInRange:NSMakeRange(1,10)]; [myOutlet setAttributedStringValue:maStr1]; } @end