我在滾動視圖中創建1000個視圖。這需要更多時間來加載視圖。在滾動視圖中創建1000個視圖需要時間
wordsDetails *wordsObj;
for(int i = 0; i<arrayOfWords.count;i++) {
UIView *viewForDisplay = [[UIView alloc]initWithFrame:CGRectMake(320*i, 0, 320, 440)];
UILabel *wordLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 40, 240, 40)];
wordLabel.backgroundColor = [UIColor clearColor];
wordLabel.textColor = [UIColor yellowColor];
wordLabel.font = [UIFont fontWithName:@"Didot" size:24.0];
wordsObj = [arrayOfWords objectAtIndex:i];
wordLabel.text = wordsObj.word;//[NSString stringWithFormat:@"sdssds - %i",i];
[viewForDisplay addSubview:wordLabel];
UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(30, 100, 240, 100)];
textView.text = wordsObj.meaning;
textView.editable = NO;
textView.textColor = [UIColor whiteColor];
textView.font = [UIFont fontWithName:@"Didot" size:20.0];
textView.backgroundColor = [UIColor clearColor];
[viewForDisplay addSubview:textView];
[fScrollView addSubview:viewForDisplay];
}
有沒有辦法在線程中調用它。
看看這個鏈接https://github.com/gmoledina/GMGridView – Leena