2
我正在嘗試我的代碼在我的墊上,它崩潰了。設備日誌上沒有任何內容,但未知類型和未知進程。所以我挖了。我認爲這是一個記憶問題。我發現我無法在水平滾動視圖中添加太多圖像。我有100多個。水平滾動視圖對象限制?
這是我的代碼
for(int index=0; index < 166; index++)
{
UIImageView *imgscv = [[UIImageView alloc] init];
imgscv.bounds = CGRectMake(0, 0, 200, 250);
imgscv.frame = CGRectMake(5+xOffset, 5, 200, 250);
imgscv.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",index-1]];
[images insertObject:imgscv atIndex:index];
scrollview.contentSize = CGSizeMake(scrollWidth+xOffset,110);
[scrollview addSubview:[images objectAtIndex:index]];
xOffset += 205;
}
當我在for循環改變指數的上限16一切都fine.So是嗎?有限制嗎?您可能會提出任何修復或替代方案?
尋呼解決了我的問題。加載上一頁,當前頁和下一頁並釋放剩下的部分就是我猜的技巧。感謝您的洞察力。 –