【发布时间】:2012-07-02 21:15:17
【问题描述】:
我的 UIScrollView 有很多行(~100),我实现了 dequeueReusableRow 方法来快速分配和添加我的子视图(行)。一切正常,但如果我滚动速度非常快,则某些视图不会在稍后及时添加到 scrollView。
- (UIView *)dequeueReusableRow
{
UIView *view = [reusableRows anyObject];
if(view)
{
[[view retain] autorelease];
[reusableRows removeObject:view];
}else{
view = [[UIView alloc] init....
}
return view;
}
- (void)addVisibleRows
{
UIView *row = [self dequeueReusableRow];
row.frame = ....
[scrollView addSubview:row]
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self addVisibleRows];
[self removeInvisibleRows];
}
请不要建议我使用 UITableView,因为手风琴的结构看起来像:
section
- section
-- section
--- row
- section
section
- row
【问题讨论】:
-
我建议你使用 UITableView。 stackoverflow.com/questions/1944428/…
标签: iphone ios uitableview uiscrollview