私は単純なフォトギャラリーを作成しています.スクロールビューに1024x768の約60枚の画像を配置すると、実行が非常に遅くなったり、アプリがクラッシュしたりすることがあります.何が間違っていますか?
-(void)sethomeview:(UIScrollView *)selscroll numimg:(int)numimg section:(NSString *)section
{ selscroll.delegate = self;
selscroll.contentSize = CGSizeMake(160*numimg,80);
sezione=section;
for (int i=1; i<numimg+1; i++)
{
NSString *fullpath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:[NSString stringWithFormat:@"/%@%d.jpg",sezione,i]];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake((i-1)*165,0, 160, 80)];
[button setImage:[UIImage imageWithContentsOfFile:fullpath] forState:UIControlStateNormal ];
[button setTitle:sezione forState:UIControlStateNormal];
[button addTarget:self action:@selector(homepremuta:) forControlEvents:UIControlEventTouchDown];
button.tag =i;
[selscroll addSubview:button];
}
}