在我的iPAd应用程序中
我正在使用AQGridView。
它有很多卡片。
单击按钮,我将更改图像数组。(意思是替换图像)。
-Code,用于加载卡片的图像,我已经写在下面的方法。
- (AQGridViewCell *) gridView: (AQGridView *) aGridView cellForItemAtIndex: (NSUInteger) index*现在该方法被调用两次八次运算。
1.当第一次显示单元格时。(分配).
**2.当你滚动AQGridView.*
下面是该方法的堆栈。

现在当我手动调用
LayoutSubviews
OR
[self.gridView reloadData];在AQGridView的这种方法中,有些参数是不同的。
它不在all.Means上工作,无法调用该方法。
所以,我调用这个方法,比如,你还有其他的解决方案吗?
for(int i=0;i<[toShowArray count];i++)
{
[self.gridView.dataSource gridView:self.gridView cellForItemAtIndex:i];
} 发布于 2012-07-18 09:40:23
只要您按如下方式连接数据源,[self.gridView reloadData];最终应该调用cellForItemAtIndex:
self.gridView.dataSource = self;但是,由于您请求了其他解决方案,因此也应该对每个元素调用cellForItemAtIndex:
int dataElemCount = [toShowArray count];
NSIndexSet* indices = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, dataElemCount)];
[self.gridView beginUpdates];
[self.gridView reloadItemsAtIndices:indices withAnimation:AQGridViewItemAnimationFade];
[self.gridView endUpdates];注意,reloadItemsAtIndices只在beginUpdates和endUpdates中工作。您还可以将动画更改为您喜欢的任何其他AQGridViewItemAnimation。
https://stackoverflow.com/questions/9733304
复制相似问题