how do i remove all subviews from my scrollview...
i have a uiview and a button above it in the scrollview something like this....
here is my code to add sub
I don't think you should use the fast enumeration suggestion.
for(UIView *subview in [view subviews]) {
[subview removeFromSuperview];
}
Isn't this supposed to throw an exception if you change the collection being iterated? http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocFastEnumeration.html#//apple_ref/doc/uid/TP30001163-CH18-SW3
This example may be better.
NSArray *subviews = [[scroller subviews] copy];
for (UIView *subview in subviews) {
[subview removeFromSuperview];
}
[subviews release];