• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing content of object inside NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing content of object inside NSMutableArray


  • Subject: Re: Changing content of object inside NSMutableArray
  • From: Ken Thomases <email@hidden>
  • Date: Fri, 3 Jul 2009 22:42:17 -0500

On Jul 2, 2009, at 5:36 PM, Agha Khan wrote:

I have saved some objects inside GameArray (type NSMutableArray) and I would like to change of content of an object inside that array.

GameObj is type of UIView so it has a frame.

GameObj* p = [GameArray objectAtIndex:0];
p.frame = frame;

This works, but this is not changing the content inside the GameArray.

What do you mean it "is not changing the content inside the GameArray"? By what means are you detecting this?


It is most definitely the case that the above code snippet is changing the frame of the object at index 0 of the array. An array contains references to objects. It doesn't really contain the objects themselves. So, the pointer 'p' in your snippet is a reference to the same object that the array has a reference to. There's no way for the change you make through 'p' to not affect the object referred to by the array, since they are the same object.

If you think it is not changing the object in the array, then you are confused or mistaken.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Changing content of object inside NSMutableArray (From: Agha Khan <email@hidden>)

  • Prev by Date: Re: Send files from iphone
  • Next by Date: [Moderator] Re: Securely limit the running an application by serial number
  • Previous by thread: Re: Changing content of object inside NSMutableArray
  • Next by thread: Re: disabling grammar checking
  • Index(es):
    • Date
    • Thread