For(UIView * subView . View. Subviews)
{
if([subView iskindofclass: [xyzseniorqueryview class]] )
{
[SubView removefromsuperview];
SubView = nil; error
}
}
Error message:
Fast Enumeration variables can ' t be modified on ARC by default;declare the variable __strong to allow THIS
Other words:
The Fast enumeration variable under ARC cannot modify its Reference property by default , declaring that the variable is __strong allowed.
Follow the prompts to modify the above statement:
for(__strong UIView * subView on self. View. Subviews)
or
for(UIView __strong * subView on self. View. Subviews)
This will work as expected.
In addition, there is a special fast-enumerating iterator class Nsenumerator in OC, which is used in the following way:
// get a corresponding enumerator object
Nsenumerator * Enumerator = [self.view.subviews reverseobjectenumerator];
For (UIView * views = [enumerator nextobject];;) // traversal
{
if ([Views Iskindofclass:[xyzseniorqueryview class]])
{
[Views Removefromsuperview];
views = nil;
}
}
Ext.: http://lqcjdx.blog.163.com/blog/static/20748924120139501547298/
Quick enumeration of iOS