UILineBreakMode Vs的NSLineBreakMode(UILineBreakMode

2019-08-01 03:06发布

我看到一些UIStringDrawing方法已被更新为使用NSLineBreakMode代替UILineBreakMode在iOS的6.0:

- (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(NSLineBreakMode)lineBreakMode

我如何检查是为了确保我的iOS 5用户和下面继续使用UILineBreakMode?

Answer 1:

没有检查是必要的。 这些只是枚举和它们映射到相同的值

你可以看到这里没有真正的差别:

UILineBreakMode VS NSLineBreakMode

  enum {
   NSLineBreakByWordWrapping = 0,
   NSLineBreakByCharWrapping,
   NSLineBreakByClipping,
   NSLineBreakByTruncatingHead,
   NSLineBreakByTruncatingTail,
   NSLineBreakByTruncatingMiddle
};
typedef NSUInteger NSLineBreakMode



typedef enum {
   UILineBreakModeWordWrap = 0,
   UILineBreakModeCharacterWrap,
   UILineBreakModeClip,
   UILineBreakModeHeadTruncation,
   UILineBreakModeTailTruncation,
   UILineBreakModeMiddleTruncation,
} UILineBreakMode;


Answer 2:

UILineBrakeMode在iOS6的弃用http://developer.apple.com/library/ios/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html#//apple_ref/doc/c_ref/UILineBreakMode



文章来源: UILineBreakMode Vs NSLineBreakMode