PCoder123
PCoder123

Reputation: 364

Returning an Array Of ImageViews (IPhone)?

I understand that:

But how about if I wanted to return an Array of ImageViews?

Upvotes: 2

Views: 122

Answers (3)

EmilioPelaez
EmilioPelaez

Reputation: 19884

If you're worried about it not being very clear about the fact that the array has UIImageViews, you can specify it on the name of the method, something like:

-(NSArray *)imageViewsForSomething:(id)something;

Otherwise, there's no reason you'd need to return explicitly an array of UIImageViews, an NSArray will do the trick.

Upvotes: 2

Sumit Kumar
Sumit Kumar

Reputation: 11

NSArray is a stack of memory which stores object you add to it.

To store imagesviews, create an object of imageview and insert it in the array. If you have to create long list of imageviews, you can create them using some iterative loop and add them in the array.

The array will hold on the imagesviews in it.

I am a newbie here, sorry if maid a mistake in above answer...

Upvotes: 1

MLefrancois
MLefrancois

Reputation: 768

Arrays and other container objects cannot be type in Objective-C like you can di in java.

One possible solution would be to subclass the NSArray class

Upvotes: 1

Related Questions