2
我正在爲我的項目使用AQGridView。我面臨的問題是我無法啓用GridView的編輯模式。我想要的是,無論何時點擊編輯按鈕,刪除圖標應顯示在每個單元格上,單擊再次編輯按鈕將使編輯模式禁用。如何啓用AQGridView編輯模式?
這裏是我的代碼不除第一個函數工作:
- (void) handleEditModeChange:(NSNotification *) note
{
if(self.gridView.isEditing)
{
[self.gridView setEditing:NO animated:YES];
NSLog(@"gridView edit mode");
}
else
{
[self.gridView setEditing:YES animated:YES];
NSLog(@"gridView NOT edit mode");
}
}
- (UITableViewCellEditingStyle)gridView:(AQGridView *) aGridView editingStyleForRowAtIndex:(NSUInteger) index {
NSLog(@"editing style");
// Detemine if it's in editing mode
if(self.gridView.isEditing) {
return UITableViewCellEditingStyleDelete;
}
return UITableViewCellEditingStyleNone;
}
- (void) gridView:(AQGridView *) aGridView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndex:(NSUInteger) index {
NSLog(@"editing");
}
- (BOOL)gridView:(AQGridView *) aGridView canEditRowAtIndex:(NSUInteger) index {
NSLog(@"canEditRowAtIndex");
return YES;
}
這些代碼是在與AQGridViewDelegate,AQGridViewDataSource已經comforms視圖控制器。
上面的第一個函數可以正常工作,但第二個函數不會因爲某種原因而被調用。
下面的數據源函數可以正常工作。
- (AQGridViewCell *) gridView: (AQGridView *) aGridView cellForItemAtIndex: (NSUInteger) index;
我是這個新手初學者。有人可以告訴我,如果這是可能的,或者如果我做錯了什麼?
任何建議,我明白了。