どーしよー。

エピソード1 どーしよーの旅立ち

あ、UILineBreakMode◯◯も使えないんだった!

前回の記事から数時間経過・・・

あ、UITextAlignment◯◯は使えないんだった! - どーしよー。

まだ警告が残ってる!

'UILineBreakModeTailTruncation' is deprecated: first deprecated in iOS 6.0

そうだ、UILineBreakMode◯◯も使えないんだ・・・

ホントすぐ忘れるんでメモ。

iOS5までは、この定義で大丈夫。
// Deprecated: use NSLineBreakMode instead
typedef NS_ENUM(NSInteger, UILineBreakMode) {
    UILineBreakModeWordWrap = 0,            // Wrap at word boundaries
    UILineBreakModeCharacterWrap,           // Wrap at character boundaries
    UILineBreakModeClip,                    // Simply clip when it hits the end of the rect
    UILineBreakModeHeadTruncation,          // Truncate at head of line: "...wxyz". Will truncate multiline text on first line
    UILineBreakModeTailTruncation,          // Truncate at tail of line: "abcd...". Will truncate multiline text on last line
    UILineBreakModeMiddleTruncation,        // Truncate middle of line:  "ab...yz". Will truncate multiline text in the middle
} NS_DEPRECATED_IOS(2_0,6_0);
iOS6以降は、この定義。
// NSParagraphStyle
typedef NS_ENUM(NSInteger, NSLineBreakMode) {    /* What to do with long lines */
    NSLineBreakByWordWrapping = 0,  /* Wrap at word boundaries, default */
    NSLineBreakByCharWrapping,      /* Wrap at character boundaries */
    NSLineBreakByClipping,          /* Simply clip */
    NSLineBreakByTruncatingHead,    /* Truncate at head of line: "...wxyz" */
    NSLineBreakByTruncatingTail,    /* Truncate at tail of line: "abcd..." */
    NSLineBreakByTruncatingMiddle   /* Truncate middle of line:  "ab...yz" */
} NS_ENUM_AVAILABLE_IOS(6_0);
この表のように置き換えればOKです。

内容 UILineBreakMode
(iOS5まで)
NSLineBreakMode
(iOS6から)
単語で
折り返し
UILineBreakModeWordWrap NSLineBreakByWordWrapping
文字で
折り返し
UILineBreakModeCharacterWrap NSLineBreakByCharWrapping
文字で
折り返し
UILineBreakModeClip NSLineBreakByClipping
前方省略(...wxyz) UILineBreakModeHeadTruncation NSLineBreakByTruncatingHead
後方省略(abcd...) UILineBreakModeTailTruncation NSLineBreakByTruncatingTail
中央省略(ab...yz) UILineBreakModeMiddleTruncation NSLineBreakByTruncatingMiddle


どーしよー。
これでもう忘れないはず!