My cocoa app calculates the location of every mousedown event. It also checks whether the location is located inside a rectangle using NSPointInRect and while enumerating over an existing mutable array with values of the rectangles. I'm using an if-statement to add the rectangle values in which the mousedown event is located to a new array (selectedRectangles). The values are added perfectly to selectedRectangles, only problem is that previous values are overwritten. How can I solve this problem.
PS at the end of the mousedown method I use setNeedsDisplay:YES to update the data (this because selectedRectangles is used in another method).