这是添加子视图的代码,我想在添加子视图之前检查它。
numberOfViews = [[GlobalVariable sharedInstance].itemNewsDetail count];
for (int i = 0; i < numberOfViews; i++) {
@try{
CGFloat xOrigin = i * 320;
CGRect frame;
frame.size = CGSizeMake(320, 365);
frame.origin.x = xOrigin;
frame.origin.y = 0;
detailVC = [[DetailScrollVC alloc]initWithNibName:@"DetailScrollVC" bundle:nil];
detailVC.view.frame = frame;
[detailVC loadViewByIndex:i];
UIFont *font = detailVC.txtBodyNews.font;
detailVC.txtBodyNews.font = [font fontWithSize:currentFontSize];
detailVC.txtBodyNews.tag = i;
[scrollDetail addSubview:detailVC.view];
[scrollDetail sizeToFit];
[detailVC.view release];
}@catch (NSException *exception) {
NSLog(@"ERROR HANDLING : %@",exception);
}
}
如何检查和释放我之前已经添加的所有子视图。
谢谢。