Applying the same function to each object of an array in objective-c
Posted
by sagar
on Stack Overflow
See other posts from Stack Overflow
or by sagar
Published on 2010-04-26T06:37:21Z
Indexed on
2010/04/26
6:43 UTC
Read the original article
Hit count: 462
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.
© Stack Overflow or respective owner