Im struggling to solve in a very clean way a problematic involving memory overload (management). Im having a serie of view that include other views, in my project I have a situation like this:
MainView
|_PageView
页: 1
远为好,容易做面包。 由于某些原因,习俗委员会中有一名代表(protocol),因此我们在第1页的“周期”中设立了国家习俗委员会,将代表列为第2页意见中的自称(PageVew 延伸了习俗ButtonDelegate),并释放了他们喜欢的县。
{
CustomButton *customButton_ = [[CustomButton alloc] initWithFrame:CGRectMake(100.0,50+(i*55.0),200.0);
customButton.delegate = self;
[self addSubView:customButton_];
[customButton_ release];
}
迄今为止,情况再次良好。 Button将是报章,p.View获得礼宾方法,做一些成文和oil。 一个问题是,在某一时刻,主文必须删除第1页的意见,因此,在我称之为一种方法中,
[pageView_ removeFromSuperview];
[pageView release], pageView_ = nil;
pageView_ = [PageView alloc] initWithFrame.....];
and I recreate the object with other data to display. I noticed that PageView never gets release and removed from the memory because its retainCount is exactly how many CustomButton I created inside PageView and assign the delegate to self plus one of course. My question is, what is the cleanest way to remove safely all the objects and be able to remove PageView too, free the memory (because Im loading a quite large amount of data to display in it) ?
Right now i m doing:
Create in PageView a NSMutableArray, that I CustomButton the objects in it, and before to remove PageView, I cycle it and set the delegate = nil and then release each object, after I release the NSMutableArray (called "holder").
但问题是,如果我想要与其他议定书一道增加更多的不同类型的物体,从而增加这一阵列,则可能导致其他保留物体的问题。
我在什么地方缺乏教义、知识,因此我需要研究更多(我可以说的)或我需要与另一个裁军厅接触?
感谢您的gu,我超负荷处理该问题,我的大脑被困在一条近距离的道路上。