あ、UITextAlignment◯◯は使えないんだった!
数年前のプロジェクトを修正していたら、警告が!!
'UITextAlignmentCenter' is deprecated: first deprecated in iOS 6.0
あーそうだ、UITextAlignment◯◯は使えないんだった・・・
すぐ忘れちゃうんでメモ。
iOS5までは、この定義で大丈夫。
// Deprecated: use NSTextAlignment enum in UIKit/NSText.h typedef NS_ENUM(NSInteger, UITextAlignment) { UITextAlignmentLeft = 0, UITextAlignmentCenter, UITextAlignmentRight, // could add justified in future } NS_DEPRECATED_IOS(2_0,6_0);
iOS6以降は、この定義。
/* 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. NSTextAlignmentNatural = 4, // Indicates the default alignment for script } NS_ENUM_AVAILABLE_IOS(6_0);