title: convert struct to objective c array or class
body: <p>I m new for IOS. I have some source code for OS X and java. I was trying to convert to IOS. 
  In OS X, I have the following. </p>
  
  <pre><code>struct _NoteData {
      int number;             /** The Midi note number, used to determine the color */
      WhiteNote *whitenote;   /** The white note location to draw */
      NoteDuration duration;  /** The duration of the note */
      BOOL leftside;          /** Whether to draw note to the left or right of the stem */
      int accid;              /** Used to create the AccidSymbols for the chord */
  };
  typedef struct _NoteData NoteData;
  
  @interface ChordSymbol : NSObject &lt;MusicSymbol&gt; {
  
      _NoteData notedata[20];/** The notes to draw */
  
  }
  </code></pre>
  
  <p><code>_NoteData</code> is like an array and class here.  <code>number</code>, <code>whitenote</code>,<code>duration</code>..are instance variable for _noteData.</p>
  
  <p>I was trying to change struct to objective c class:</p>
  
  <pre><code>@interface  _NoteData:NSObject{
      @property NSInteger number_color;       
     @property WhiteNote *whitenote;   
     @property NoteDuration duration;  
     @property BOOL leftside;          
     @property NSInteger accid;    
    };
      @interface ChordSymbol : NSObject &lt;MusicSymbol&gt; {
  
      _NoteData notedata[20];/** The notes to draw */
  
  }
  </code></pre>
  
  <p>In my .m file, it has</p>
  
  <pre><code>+(BOOL)notesOverlap:(_NoteData*)notedata withStart:(int)start andEnd:(int)end {
      for (int i = start; i &lt; end; i++) {
  
          if (!notedata[i].leftside) {
             return YES;
         }
     }
  return NO;
  }
  </code></pre>
  
  <p><code>!notedata[i]</code> throw error <code>expected method to read array element</code>. I understand <code>_NoteData</code> is a class, not an array. What should I change?</p>
  
  <p>In java:</p>
  
  <pre><code> private NoteData[] notedata;
  </code></pre>
  
  <p><code>NoteData</code> is a class, and <code>notedata</code> is an array which store <code>NoteData</code>.
  Same method in java</p>
  
  <pre><code> private static boolean NotesOverlap(NoteData[] notedata, int start, int end) {
      for (int i = start; i &lt; end; i++) {
          if (!notedata[i].leftside) {
              return true;
          }
      }
      return false;
  }
  </code></pre>
  
  <p>I feel all I need is to declare an array with <code>_NoteData</code> object.  How can I do that?</p>