我正在制作一个简单的Photogallery,在滚动视图中放置大约60张图像1024x768会导致我执行速度非常慢甚至是应用程序崩溃,我做错了什么?
-(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];
}
}