title: How do I define and use an ENUM in Objective-C?
body: <p>I declared an enum in my implementation file as shown below, and declared a variable of that type in my interface as PlayerState thePlayerState; and used the variable in my methods. But I am getting errors stating that it is undeclared. How do I correctly declare and use a variable of type PlayerState in my methods?:</p>
  
  <p>In the .m file</p>
  
  <pre><code>@implementation View1Controller
  
      typedef enum playerStateTypes
          {
              PLAYER_OFF,
              PLAYER_PLAYING,
              PLAYER_PAUSED
          } PlayerState;
  </code></pre>
  
  <p>in the .h file:</p>
  
  <pre><code>@interface View1Controller : UIViewController {
  
      PlayerState thePlayerState;
  </code></pre>
  
  <p>in some method in .m file:</p>
  
  <pre><code>-(void)doSomethin{
  
  thePlayerState = PLAYER_OFF;
  
  }
  </code></pre>