我试图在我的应用程序中放置一个具有 1000,000 条记录的 ScrollView,此 scrollView 将在应用程序启动时加载,因此该应用程序直到百万条 1000 000 条记录才运行,这需要很长时间,我想知道有没有在记录加载时显示应用程序和滚动视图的方法(在添加记录时显示滚动视图),下面的代码正在使用:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self loadIt];
}
- (void)loadIt{
float startX = 0;
float startY = 0;
[_bigScroll setContentSize:CGSizeMake(320, 312500)];
_bigScroll.pagingEnabled = NO;
for (counter=0; counter<999999; counter++)
{
UIButton *tester=[[UIButton alloc] initWithFrame:CGRectMake(startX, startY, 10, 10)];
if (counter % 2 == 0) {
[tester setBackgroundColor:[UIColor whiteColor]];
}
else
{
[tester setBackgroundColor:[UIColor grayColor]];
}
[_bigScroll addSubview:tester];
[tester release];
if (startX == 320) {
startX = 0;
startY += 10;
}
else
startX += 10;
NSLog(@"counter = %d", counter);
}
}
请指教。