title: How to convert typedef enum to NSNumber?
body: <ol>
  <li><p>Is each value of a <code>typedef enum</code> treated as an <code>int</code>?</p>
  
  <p>E.g., given the following <code>typedef enum</code>:</p>
  
  <pre><code>// UIView.h
  
  typedef enum {
      UIViewAnimationCurveEaseInOut,
      UIViewAnimationCurveEaseIn,
      UIViewAnimationCurveEaseOut,
      UIViewAnimationCurveLinear
  } UIViewAnimationCurve;
  </code></pre>
  
  <p>How do I know which method to use to create an <code>NSNumber</code>?</p>
  
  <pre><code>+ (NSNumber *)numberWithShort:(short)value;
  + (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
  + (NSNumber *)numberWithInt:(int)value;
  + (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
  + (NSNumber *)numberWithLong:(long)value;
  + (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
  + (NSNumber *)numberWithLongLong:(long long)value;
  + (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
  + (NSNumber *)numberWithInteger:(NSInteger)value NS_AVAILABLE(10_5, 2_0);
  + (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value NS_AVAILABLE(10_5, 2_0);
  </code></pre>
  
  <p>I think <code>+[NSNumber numberWithInt:]</code> is the correct method to use because the <a href="https://stackoverflow.com/a/1624352/242933">accepted answer to Best way to implement Enums with Core Data</a> uses it. E.g.:</p>
  
  <pre><code>[NSNumber numberWithInt:UIViewAnimationCurveLinear]
  </code></pre>
  
  <p>But, if <code>+[NSNumber numberWithInt:]</code> is correct, then why?</p></li>
  <li><p>For a bitwise <code>enum</code>, e.g.:</p>
  
  <pre><code>enum {
      UIViewAutoresizingNone                 = 0,
      UIViewAutoresizingFlexibleLeftMargin   = 1 &lt;&lt; 0,
      UIViewAutoresizingFlexibleWidth        = 1 &lt;&lt; 1,
      UIViewAutoresizingFlexibleRightMargin  = 1 &lt;&lt; 2,
      UIViewAutoresizingFlexibleTopMargin    = 1 &lt;&lt; 3,
      UIViewAutoresizingFlexibleHeight       = 1 &lt;&lt; 4,
      UIViewAutoresizingFlexibleBottomMargin = 1 &lt;&lt; 5
  };
  typedef NSUInteger UIViewAutoresizing;
  </code></pre>
  
  <p>I'm guessing that <code>+[NSNumber numberWithUnsignedInteger:]</code> is the correct method to use because there is an explicit <code>NSUInteger</code> after <code>typedef</code>. Correct? E.g.:</p>
  
  <pre><code>[NSNumber numberWithUnsignedInteger:UIViewAutoresizingNone]
  </code></pre></li>
  </ol>