移除所有子视图,无需循环只需要一句代码
[view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
实现原理:实际上是用了NSArray的makeObjectsPerformSelector方法,向subviews array中每个元素发送removeFromSuperview消息,让系统帮你实现了循环.
[view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];