Quote:
Originally Posted by CBGraham
Elegant is a dirty word. makeObjectsPerformSelector says in the docs that you shouldn't give it something that modifies the array. removeFromSuperview does. Make a copy of the subviews array and work on it and stop trying to write one line solutions. (Same problem as a vanilla For loop affecting the array it is working over.)
|
If you had actually read the documentation before posting, then you would know that this is unnecessary, since subviews is a copy property. Plus it is an NSArray, not an NSMutableArray, therefore it cannot be modified. So if this solution didn't work, it would crash very quickly, and this would have been noted here in this thread quite some time ago.