Applying the same function to each object of an array in objective-c
- by sagar
Hey ! every one.
I am having some query regarding Objective-c.
Let's have a look to following code.
NSArray *ar=[scrPDFPage subviews];
int i;
for (i=0; i<[ar count]; i++) {
[(UIView*)[ar objectAtIndex:i] removeFromSuperview];
}
now my queries are as follows,
Instead of rotating a loop, isn't there an option like,
[ar applyFunctionToObjects:@selector(myFunction:)]
Isn't there any option like
[myView removeAllSubViews];
( According to my knowledge, there is no option like remove all sub views, but in case you might know. )
Thanks in advance for sharing your knowledge.
Sagar.