macOS/iOS API解説

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

目次

alignment

調査中

解説

調査中
最初または選択している段落、またはプレーンテキストの場合は全てのテキストの配置を返します。
【NSTextAlignment】
● NSLeftTextAlignment 左揃え
● NSRightTextAlignment 右揃え
● NSCenterTextAlignment センター揃え
● NSJustifiedTextAlignment ジャスティファイ
● NSNaturalTextAlignment 自動(初期設定)
NSNaturalTextAlignmentは文字の言語の自然な配置として、他の配置のうちの1つを使って表示されます。

返り値

( NSTextAlignment )

テキスト配置

引数

フレームワーク

ApplicationKit

クラス

NSText

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{

[myOutlet setString:@"abcdefghijklmn"];

switch([myOutlet alignment]){
            case 0:
            NSLog(@"NSLeftTextAlignment");
        break;
            case 1:
            NSLog(@"NSRightTextAlignment");
        case 2:
            NSLog(@"NSCenterTextAlignment");
            break;

        case 3:
            NSLog(@"NSJustifiedTextAlignment");
            break;
        case 4:
            NSLog(@"NSNaturalTextAlignment");
            break;
    }

}

@end