tags:

views:

20

answers:

2

Is it possible to store dynamically created UIViews into an NSMutableArray? This question suddenly occurred to me. Have any one done it before?

A: 

Is possible, Why wouldn't work? ;)

All views are objects. NSObject>UIResponder>UIView But why would you need to store your views in an array? You can get all subviews of a certain view by doing:

NSArray *arrayOfView = [view subviews]; 
//also:
NSMutableArray *mutableArrayOfView = [[view subviews] mutableCopy];

You actually don't need to store them, they are already stored for you ;)

nacho4d
Is UIView considered an object?
Melvin Lai
Cos I wanna store all actions I have done on that view into an array, and hopefully when I call it back. Those actions done will remain.
Melvin Lai
A: 

everything that inherits from NSObject can be stored in NS(Mutable)Array.

use the class browser in the Project Menu to see that literally everything inherits from NSObject.

fluchtpunkt
i see, thanks for the info. learned something new today :)
Melvin Lai