NSControl:alignment
Home 目次>ApplicationKit>NSControl

alignment

コントロールの文字揃えを返します


-(NSTextAlignment) alignment


【返り値】
   NSTextAlignment文字揃え


【解説】

コントロールの文字揃えを返します。
【NSTextAlignment】
● NSLeftTextAlignment 左揃え
● NSRightTextAlignment 右揃え
● NSCenterTextAlignment センター揃え
● NSJustifiedTextAlignment ジャスティファイ
● NSNaturalTextAlignment 自動(初期設定)
NSNaturalTextAlignmentは文字の言語の自然な配置として、他の配置のうちの1つを使って表示されます。
属性付き文字列(AttrubutedString)が入っていると、そちらが優先されます。



【例文】


#import "scriptSend.h"

@implementation scriptSend

- (
IBAction )myAction:( id )sender
{
[sender setTitle:
@"text" ]; //sender はボタン

[sender setAlignment:NSLeftTextAlignment];

[myOutlet setAlignment:[sender alignment]];
//sender は別のボタン

switch ([sender alignment]){

case NSLeftTextAlignment:
{
NSLog(
@"NSLeftTextAlignment" ); break ;
}
case NSRightTextAlignment:
{
NSLog(
@"NSRightTextAlignment" ); break ;
}
case NSCenterTextAlignment:
{
NSLog(
@"NSCenterTextAlignment" ); break ;
}
case NSJustifiedTextAlignment:
{
NSLog(
@"NSJustifiedTextAlignment" ); break ;
}
default :
{
NSLog(
@"NSNaturalTextAlignment" ); break ;
}
}

}
@end


(C) 2000-2007 Satoshi Oomori.
[Apple]

Google
Webwww.oomori.com
Apple_Store_40x120

[ad:Usual day in Japan]

この記事を評価してください。 

良い 

間違いがある 説明がわかりにくい 例文がわかりにくい  

Home 目次>ApplicationKit>NSControl
修正日2006.12.26