我尝试使用此方法获取所有子视图,但是当我运行应用程序时,我有一条消息发送到 deallocated instance 错误。
subviewsArray = self.view.subviews;
for (int i=0; i <subviewsArray.count; i++) {
UIView *subview = [subviewsArray objectAtIndex:i];
if (subview.tag >= 0) {
[subview removeFromSuperview];
}
}
在我的 .h
@property (nonatomic, strong) NSArray *subviewsArray;