我在我的应用程序中使用了 GMGridView。当我改变方向时一切都很好,但如果我再次改变它并进入编辑模式,除了右下角可见的单元格之外,所有单元格都在摇晃。GmGridView 作为子视图添加到控制器中,它也不会占据整个屏幕。我尝试在发生轮换通知时销毁它并重新创建它......同样的行为。此外,我还制作了一个带有多个按钮和标签的自定义视图,这些按钮和标签已设置为 GMGridViewCell 的 contentView。
这是 cellForItemAtIndex 的代码
- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
GMGridViewCell *cell = [gmGridView dequeueReusableCell];
if (!cell) {
CGSize cellSize = [self GMGridView:gmGridView sizeForItemsInInterfaceOrientation:orientation];
cell = [[GMGridViewCell alloc] initWithFrame:CGRectMake(0, 0, cellSize.width, cellSize.height)];
cell.deleteButtonIcon = [UIImage imageNamed:@"delete_button"];
cell.deleteButtonOffset = CGPointMake(0, 0);
}
CustomGridViewCell *gridViewContent = [CustomGridViewCell getNewGridViewCellForOrientation:orientation];
ContentData *data = [wishlistContentArray objectAtIndex:index];
[gridViewContent setuprWithContent:data];
cell.contentView = gridViewContent;
if (!gridViewContent.delegate)
gridViewContent.delegate = self;
return cell;
}