macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

alignment

セルのテキスト配置を返します

解説

セルのテキスト配置を返します。
【NSTextAlignment】
● NSLeftTextAlignment 左揃え
● NSRightTextAlignment 右揃え
● NSCenterTextAlignment センター揃え
● NSJustifiedTextAlignment ジャスティファイ
● NSNaturalTextAlignment 自動(初期設定)
NSNaturalTextAlignmentは文字の言語の自然な配置として、他の配置のうちの1つを使って表示されます。

返り値

( NSTextAlignment )

テキスト配置

引数

フレームワーク

ApplicationKit

クラス

NSCell

Instance Methods

使用可能

10.0

参照

- setAlignment:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
[bCell1 setAlignment:NSRightTextAlignment];
    switch([bCell1 alignment] ){
    case NSLeftTextAlignment:
        NSLog(@"NSLeftTextAlignment");
        break;
    case NSRightTextAlignment:
        NSLog(@"NSRightTextAlignment");
        break;
    case NSCenterTextAlignment:
        NSLog(@"NSCenterTextAlignment");
        break;
    case NSJustifiedTextAlignment:
        NSLog(@"NSJustifiedTextAlignment");
        break;
    case NSNaturalTextAlignment:
        NSLog(@"NSNaturalTextAlignment");
        break;
    default:
        NSLog(@"default");
    
    }

}

@end