开发者

Initialization of controllers in a for loop - leaking problem?

I am creating a kinda gallery and for each gallery I created a view controller whose view is added to a scrollview (see code below) :

GalleryViewController *galViewController;

 for (NSUInteger i = 0 ; i < [galleries count]; i++) {

  galViewController = [[GalleryViewController alloc] init]; 
  galViewController.record = [galleries objectAtIndex:i];
  //galViewController.position = i;

  galViewController.view.frame = CGRectMake(i%3*100,i/3*150,100,150);
  [galViewController setDelegate:self];

  [self.scrollView addSubview:galViewController.view];
  //[galViewController release];

 }

Is this code leaking ? I think so ... but the thing is that I don't know what to do with these开发者_高级运维 controllers ... i can't release them (cause I got some code to use in the future like touches event) and I don't need to save them somewhere ...

Is this a problem to have this kind of code ?

Thks,

Gotye

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜