Changes between Version 24 and Version 25 of entity


Ignore:
Timestamp:
01/04/2012 10:57:21 AM (14 years ago)
Author:
leijingtang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • entity

    v24 v25  
    3333}}} 
    3434 
     35 
     36=== 视图控制器的生命周期方法编写规范 === 
     37 
     38- (void)dealloc { 
     39    // 必须调用父类方法;使用引用变量来释放;释放完了以后必须将指针置空。 
     40    [super dealloc]; 
     41    [_example release]; 
     42    [_example = nil]; 
     43} 
     44 
     45- (void)loadView { 
     46    // 必须调用父类方法;这里主要用于布局视图。 
     47} 
     48 
     49- (void)viewDidLoad { 
     50    // 初始化数据,比如发送网络请求。 
     51} 
     52 
     53- (void)viewDidUnload { 
     54    // 释放在loadView和viewDidLoad里初始化的实例变量,同时将指针置空。 
     55    // 因为图片浏览应用比较容易发生内存警告,所以比较好的做法是把图片实体释放掉; 
     56    // 比如,通常cell包含imageView,在发生内存警告时,可以将imageView的image属性置空。 
     57    // 为了使释放的效率更高,可以将置空的代码放置在自动释放池的管理下,如下: 
     58    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
     59    cell.imageView.image = nil; 
     60    [pool release]; 
     61} 
     62 
     63- (void)viewWillAppear:(BOOL)animated { 
     64    //  
     65} 
     66 
    3567本地项目(LocalItem)://用于抽象用户保存在本地的图片和图集,也就是说一个LocalItem可以是图片,也可以是图集 
    3668