UIKit —— NSText

//
//  NSText.h
//  UIKit
//
//  Copyright (c) 2011-2015 Apple Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#if __has_include(<CoreText/CTParagraphStyle.h>)
#import <CoreText/CTParagraphStyle.h>
#endif
#import <UIKit/UIKitDefines.h>

NS_ASSUME_NONNULL_BEGIN

/* Values for NSTextAlignment */
typedef NS_ENUM(NSInteger, NSTextAlignment) {
    NSTextAlignmentLeft      = 0,    // Visually left aligned  左對其
#if TARGET_OS_IPHONE    
    NSTextAlignmentCenter    = 1,    // Visually centered  居中
    NSTextAlignmentRight     = 2,    // Visually right aligned  右對其
#else /* !TARGET_OS_IPHONE */
    NSTextAlignmentRight     = 1,    // Visually right aligned
    NSTextAlignmentCenter    = 2,    // Visually centered
#endif
    NSTextAlignmentJustified = 3,    // Fully-justified. The last line in a paragraph is natural-aligned. 
   // 完全有道理。一個段落的最后一行是natural-aligned。

    NSTextAlignmentNatural   = 4,    // Indicates the default alignment for script 顯示腳本的默認對齊方式
} NS_ENUM_AVAILABLE_IOS(6_0);

#if __has_include(<CoreText/CTParagraphStyle.h>)
// 文本對其方式切換函數
// CTTextAlignment 和 NSTextAlignment 進行互換
UIKIT_EXTERN CTTextAlignment NSTextAlignmentToCTTextAlignment(NSTextAlignment nsTextAlignment) NS_AVAILABLE_IOS(6_0);
UIKIT_EXTERN NSTextAlignment NSTextAlignmentFromCTTextAlignment(CTTextAlignment ctTextAlignment) NS_AVAILABLE_IOS(6_0);
#endif

/* Values for NSWritingDirection */
// 寫作方向
typedef NS_ENUM(NSInteger, NSWritingDirection) {
    NSWritingDirectionNatural       = -1,    // Determines direction using the Unicode Bidi Algorithm rules P2 and P3   決定了方向使用Unicode Bidi算法規則P2和P3
    NSWritingDirectionLeftToRight   =  0,    // Left to right writing direction  從左到右
    NSWritingDirectionRightToLeft   =  1     // Right to left writing direction  從右到左
} NS_ENUM_AVAILABLE_IOS(6_0);

NS_ASSUME_NONNULL_END

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容