博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pad点餐系统 内存管理的一点总结
阅读量:6590 次
发布时间:2019-06-24

本文共 3135 字,大约阅读时间需要 10 分钟。

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];            }        }    }}

 

转载地址:http://dozio.baihongyu.com/

你可能感兴趣的文章
Delphi XE5 for Android (三)
查看>>
爬虫-----自定义框架
查看>>
Django--CRM-客户列表展示, 分页
查看>>
SELinux处理命令
查看>>
对自己狠才能成功
查看>>
mysql中int、bigint、smallint 和 tinyint的区别详细介绍
查看>>
Go语言极速入门手册
查看>>
数据结构学习(1):单链表
查看>>
Oracle备份数据库
查看>>
paramiko模块
查看>>
Python之路——网络编程
查看>>
uva 11732 "strcmp()" Anyone?
查看>>
php实现无限级分类(递归方法)
查看>>
线程学习一
查看>>
linux常用基本命令
查看>>
博文目录
查看>>
SQL系列(二)—— 查询(select)
查看>>
Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结
查看>>
jdk和jre是什么?都有什么用?(转帖)
查看>>
zw版_zw中文增强版Halcon官方Delphi例程
查看>>