| Home 目次>ApplicationKit>NSParagraphStyle このサイトはこちらに移転しました。 | |
alignment
レシーバーのテキスト配置を返します
-(NSTextAlignment) alignment
【返り値】 | |
| NSTextAlignment | テキスト配置 |
【解説】
レシーバーのテキスト配置を返します。
【NSTextAlignment】
● NSLeftTextAlignment 左揃え
● NSRightTextAlignment 右揃え
● NSCenterTextAlignment センター揃え
● NSJustifiedTextAlignment ジャスティファイ
● NSNaturalTextAlignment 自動(初期設定)
NSNaturalTextAlignmentは文字の言語の自然な配置として、他の配置のうちの1つを使って表示されます。
【例文】
#import "MyObject.h"
@implementation MyObject
- (IBAction)myAction:(id)sender
{
NSTextTab *tabStop = [[NSTextTab alloc] initWithType:NSLeftTabStopType
location:144];
NSMutableParagraphStyle *pStyle = [NSMutableParagraphStyle defaultParagraphStyle];
[myOutlet setUsesRuler:YES];
[myOutlet setRulerVisible:YES];
switch ([pStyle alignment]){
case NSLeftTextAlignment:
NSLog(@"");
break;
case NSRightTextAlignment:
NSLog(@"NSRightTextAlignment");
break;
case NSCenterTextAlignment:
NSLog(@"NSCenterTextAlignment");
break;
case NSJustifiedTextAlignment:
NSLog(@"NSJustifiedTextAlignment");
break;
case NSNaturalTextAlignment:
NSLog(@"NSNaturalTextAlignment");
break;
default :
break;
}
}
@end
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSParagraphStyle | 修正日2006.12.26 |