Skip to content

Instantly share code, notes, and snippets.

@neilinglis
Created December 11, 2012 17:50
Show Gist options
  • Save neilinglis/4260598 to your computer and use it in GitHub Desktop.
Save neilinglis/4260598 to your computer and use it in GitHub Desktop.
NSTextAlignment Naming Differences
Am I out of order being annoyed at things like this? The naming has changed subtly, the direction is at the end in UIKit but at the start on AppKit. If I'm writing cross platform code then I need to either use the int values directly, which is bad practice, or use a define.
UIKit:
enum {
NSTextAlignmentLeft = 0,
NSTextAlignmentCenter = 1,
NSTextAlignmentRight = 2,
NSTextAlignmentJustified = 3,
NSTextAlignmentNatural = 4,
};
typedef NSInteger NSTextAlignment;
AppKit:
typedef enum _NSTextAlignment {
NSLeftTextAlignment = 0,
NSRightTextAlignment = 1,
NSCenterTextAlignment = 2,
NSJustifiedTextAlignment = 3,
NSNaturalTextAlignment = 4
} NSTextAlignment;
@randomsequence
Copy link

I think they differ in UIKit so that the new NSTextAlignment values were the same as their deprecated UITextAlignment counterparts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment