title: How do I increment an int value in an NSMutableArray?
body: <p>I got:</p>
  
  <pre><code>@interface ViewController : UIViewController
  {
      int index_counter;
      //NSMutableArray *logins;
  }
  @property (weak, nonatomic) IBOutlet UITextField *count;
  @property (strong, nonatomic) NSMutableArray *logins;
  - (IBAction)next_button:(id)sender;
  @end
  </code></pre>
  
  <p>Which is an array that holds objects:</p>
  
  <pre><code>@interface THEOBJECT : NSObject 
  {
      NSString *uname;
      int counter;
  }
  -(void) SetUser: (NSString *) username;
  -(void) SetCount: (int) value;
  -(void) print;
  @property (nonatomic, retain) NSString *uname; 
  @property (nonatomic,readwrite) int counter; //not sure if this is correct
  @end
  
  @implementation SiteValue
  
  @synthesize uname;
  @synthesize counter;
  
  
  -(void) SetCount:(int) value
  {
      counter=counter+1;    
  }
  
  @end
  </code></pre>
  
  <p>and my method should increment the count value in the object THEOBJECT in each index of the array:</p>
  
  <pre><code>- (IBAction)next_button:(id)sender
  {
      index_counter=index_counter-1;
      if (index_counter&lt;0)
      {
          index_counter=0;
      }
      username.text=[[logins objectAtIndex:index_counter] uname];
      [[logins objectAtIndex:index_counter] counter]=[[logins objectAtIndex:index_counter] counter]+1; //ERROR HERE.
  }
  </code></pre>
  
  <p>Where I wrote "ERROR HERE", it should increment the count value every time I push the <em>next</em> button and store +1 in the array. <strong>But it's giving me a readonly error.</strong> The exact error is <code>"assigning to 'readonly' return result of an Objective-C message not allowed"</code>. I think the best thing to do is to call the <code>setcount:</code> method but it's not letting me call it since it's two different interfaces. Any ideas?</p>