画像ギャラリーとサムネイルギャラリーでたくさんの画像を読み込みます。ボタン(セクション)を押すたびに、画像が正しいseciontの画像で置き換えられます。 7回私はこれを私のアプリケーションのクラッシュを行う。 私は割り振りツールを使ってビルドを試みましたが、私はボタンを押すたびに割り当てメモリが増えていくのを見ています!私は initWithContentOfFileで成長していないスタックメモリの割り当てを見ることができます。 何が間違っていますか?UIImagaViewのXcode割り当てに関する問題が増え続けています
for (UIView *view in [scroller subviews]) {
[view removeFromSuperview];
}
for (UIView *view in [thumbnail subviews]) {
[view removeFromSuperview];
}
for (int i=1; i<numeroimg+1; i++) {
UIImageView *imagen = [[[UIImageView alloc] initWithImage:[[UIImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle]
pathForResource:[NSString stringWithFormat:@"%@%d",sezione,i]
ofType:@"jpg"]]]autorelease];
imagen.frame = CGRectMake((i-1)*1024, 0, 1024, 704);
[scroller addSubview:imagen];
UIButton *button = [[[UIButton alloc] initWithFrame:CGRectMake((i-1)*210, 30, 200, 150)]autorelease];
[button setImage:[[UIImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle]
pathForResource:[NSString stringWithFormat:@"%@%d",sezione,i]
ofType:@"jpg"]] forState:UIControlStateNormal];
[button addTarget:self action:@selector(pagina:) forControlEvents:UIControlEventTouchUpInside];
button.tag = i;
[thumbnail addSubview:button];
}
を排出するようにしてください、あなたは、ARCを使用していますか? – Michael
nopは古いバージョンのxcodeで作業を開始しなければならなかったので、それを置くことができません – Yazo
プロジェクトをARCに変換すると、WWDC 2011のビデオがあります。 – Michael