1、向系统申请的view button array 等资源一定要及时释放。尤其是img图片,更要及时释放。
2、在pad点餐系统中使用如下方法释放view资源,真是太有必要了。
//设置按钮状态及清空视图 -(void)clearSmallOrderList:(NSString *)code{ NSLog(@"进入OrderListViewController.m的-(void)clearSmallOrderList:(NSString *)code"); for (id obj in [self.view subviews]) { if ([obj isKindOfClass:[UIButton class]]) { UIButton* theButton = (UIButton*)obj; if ([code isEqualToString:@"000"]&&theButton.tag==1) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"001"]&&theButton.tag==2) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"002"]&&theButton.tag==3) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"003"]&&theButton.tag==4) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"004"]&&theButton.tag==5) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"005"]&&theButton.tag==0) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"006"]&&theButton.tag==6) { [theButton setSelected:YES]; }else{ [theButton setSelected:NO]; } }else if([obj isKindOfClass:[UIView class]]){ UIView *view = (UIView *)obj; if(view.tag==9999||view.tag==9998||view.tag==9997||view.tag==9996){ [view removeFromSuperview]; [view release]; } } }}//设置按钮状态及清空视图 -(void)clearOrderList:(NSString *)code Title:(NSString *)title{ NSLog(@"进入OrderListViewController.m的-(void)clearOrderList:(NSString *)code Title:(NSString *)title"); for (id obj in [self.view subviews]) { if ([obj isKindOfClass:[UIButton class]]) { UIButton* theButton = (UIButton*)obj; if ([code isEqualToString:@"000"]&&theButton.tag==1) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"001"]&&theButton.tag==2) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"002"]&&theButton.tag==3) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"003"]&&theButton.tag==4) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"004"]&&theButton.tag==5) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"005"]&&theButton.tag==0) { [theButton setSelected:YES]; }else if ([code isEqualToString:@"006"]&&theButton.tag==6) { [theButton setSelected:YES]; }else if ([theButton.titleLabel.text isEqualToString:title]) { [theButton setSelected:YES]; }else [theButton setSelected:NO]; }else if([obj isKindOfClass:[UIView class]]){ UIView *view = (UIView *)obj; if(view.tag==9999||view.tag==9997||view.tag==9996){ [view removeFromSuperview]; [view release]; } } }}