用导航控制器时,如果返回的时候蹦,那就是因为dealloc里面重复释放了。
PersonCenterViewController *personCenterVC = [[PersonCenterViewController alloc]initWithNibName:@"PersonCenterViewController" bundle:nil];
[self.navigationController pushViewController:personCenterVC animated:YES];
[personCenterVC release];
//创建自己的scrollview.
myScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 180)];
self.myScrollView.backgroundColor = [UIColor whiteColor];
self.myScrollView.contentSize=CGSizeMake(320, 200);
UIImageView *shopImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 180)];
shopImageView.image = [UIImage imageNamed:@"shopImageDemo.png"];
[self.myScrollView addSubview:shopImageView];
[self.view addSubview:self.myScrollView];
self.myScrollView.scrollEnabled = NO;
[myScrollView release];
[shopImageView release];
//创建自己的tableview.
myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 180, 320, 300) style:UITableViewStyleGrouped];
self.dataArray=[NSMutableArray arrayWithObjects:@"店铺简介",@"经典发型",@"地图位置",@"热线电话:010-66228989", nil];
self.myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
self.myTableView.separatorColor = [UIColor grayColor];
self.myTableView.dataSource=self;
self.myTableView.delegate=self;
self.myTableView.backgroundView = nil;
self.myTableView.scrollEnabled = NO;
self.myTableView.backgroundColor = [UIColor grayColor];
[self.view addSubview:self.myTableView];
[myTableView release];
//section里面的内容。
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UILabel *shopNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 3, 100, 30)];
shopNameLabel.backgroundColor = [UIColor clearColor];
shopNameLabel.text = @"金融街店";
shopNameLabel.textColor = [UIColor whiteColor];
UILabel *shopAddressLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 35, 300, 20)];
shopAddressLabel.backgroundColor = [UIColor clearColor];
shopAddressLabel.text = @"北京市西城区金融大街甲26号顺成饭店首层";
[shopAddressLabel setFont:[UIFont fontWithName:@"Arial" size:13]];
shopAddressLabel.textColor = [UIColor whiteColor];
UIView *sectionView=[[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 70)]autorelease];
[sectionView setBackgroundColor:[UIColor grayColor]];
[sectionView addSubview:shopNameLabel];
[sectionView addSubview:shopAddressLabel];
[shopNameLabel release];
[shopAddressLabel release];
// [sectionView release];//这里不能直接release了,只能autorelease就行了。
return sectionView;
}
相关推荐
庄延军《iOS内存管理及优化》,一本不错的关于ios内存管理的书。
IOS 内存管理 详细讲解iOS内存管理,对于深入研究内存管理的同学必须下载啊!
IOS内存管理与软件调试,本文档介绍了iOS内存管理和软件调试方法,如何找到crash的原因,文档为英文的,不喜欢的请勿下载。
10天掌握IOS 内存管理
iOS内存管理暴风体育 分享 iOS引用计数查看引用计数:MRC: [object retainCount]强引用/弱引用普通指针: void *强引用:类似B
小议iOS内存管理-中文.pdf
ios移动开发的内存管理ppt,讲的不错,你值得拥有
通过对不同类型的对象进行retain和copy进行深浅拷贝详细测试分析
iOS高级内存管理ARC模式手动模式英文文档含示例工程,本压缩包包含国外众多高手的内存管理心得和工程示例,文档为英文,不喜欢的请勿下载。
5.1)Objective-C内存管理相关术语 5.2)什么是引用计数? 5.2.1)引用计数解释 5.2.2)文艺解释 5.2.3)代码测试 5.3)自动释放池 5.3.1)AutoreleasePool的原理 5.3.2)自动释放池的创建和销毁 5.3.3)自动释放池的使用...
IOS的内存管理详解。 Delegate具体详解,使用流程。 Speex的语音压缩技术。 完整详细解读。40页,通俗简单,深入浅出,并有代码示例ppt。
ios内存管理之遛狗原则,还有自定义数组管理内存
iOS开发有关object-c内存管理!
如何检测内存泄漏? 如何解决循环引用? 悬垂指针?野指针? 对 retain,copy,assign,weak,_Unsafe_Unretain 关键字的理解; 深拷贝和浅拷贝的深刻理解;...自动引用计数应遵循的原则;...内存管理方案 ... ... ...
3.未初始化数据:末初始化的全局变量、静态变量等 1.对字符串,字典,数组进行mutableCopy操作,属于深拷贝,并且会生成一个新的可变对象 2.对可变字符
介绍IOS内存管理的一本电子书,初学者可以很快的了解ios上的内存管理的机制,有一定经验的也可以从中得到新的收获。
强引用、弱引用 weak和strong只有你打开ARC时才会被要求使用
深入介绍IOS内存管理和多线程操作,有助于提高ios开发水命
关于iOS内存管理的规则思考 自己生成的生成的对象,自己持有。 非自己生成的对象,自己也能持有。 不在需要自己持有的对象时释放。 非自己持有的对象无法释放。 注:这里的自己是对象使用的环境,理解为编程人员...