UILineBreakMode Vs NSLineBreakMode

11,169

Solution 1

No checking is necessary. These are just enums and they map to the same values

You can see there is no real difference here:

UILineBreakMode vs NSLineBreakMode

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



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

Solution 2

UILineBrakeMode is deprecated in ios6 http://developer.apple.com/library/ios/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html#//apple_ref/doc/c_ref/UILineBreakMode

Share:
11,169

Related videos on Youtube

mootymoots
Author by

mootymoots

Updated on June 04, 2022

Comments

  • mootymoots
    mootymoots almost 2 years

    I see some UIStringDrawing methods have been updated to use NSLineBreakMode instead of UILineBreakMode in iOS 6.0:

    E.g.

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

    How can I check for this to ensure my iOS 5 users and below continue to use UILineBreakMode?

  • Daij-Djan
    Daij-Djan over 10 years
    they are equal but this offers no solution to the prob here
  • brynbodayle
    brynbodayle over 10 years
    Hmm? There is no real problem.
  • Basil Bourque
    Basil Bourque about 10 years
    @Daij-Djan So the solution is to change your code to use NSLineBreakMode to avoid compiler warnings in the latest Xcode. When compiled, the code will run compatibly on the older iOS devices.