ios8“removeFromSuperview”崩溃

时间:2015-03-12 11:04:12

标签: ios objective-c xcode

NSArray *viewsToRemove = [scrollView subviews];
for (UIView *v in viewsToRemove) {
    [v removeFromSuperview];
}

将设备更新到ios8时,代码将崩溃[removeFromSuperview],并显示消息"线程1:EXC_ACCESS(代码= 1,地址= 0x5000000c")

还有其他代码吗?

1 个答案:

答案 0 :(得分:0)

NSArray *viewsToRemove = [scrollView subviews];
for (UIView *v in viewsToRemove) {
   if ([v isKindOfClass:[UIView Class]]) {       
      [v removeFromSuperview];
   }
}