Returning an Array Of ImageViews (IPhone)?
I understand that:
(NSArray *)meth开发者_高级运维odName would return an array.
(UIImageView *)methodName would return an imageview.
But how about if I wanted to return an Array of ImageViews?
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.
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
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...
精彩评论