일부 섹션 및 일부 섹션이있는 각 섹션이있는 tableView가 있습니다. 모든 행에는 즐겨 찾기 버튼이 있습니다. 버튼을 클릭하면 행이 즐겨 찾기 섹션에 추가됩니다. (처음에는 비어 있음)행을 UITableView의 다른 섹션에 복사하십시오.
일부 코드를 작성했습니다.하지만 문제는 iOS 5 시뮬레이터에서 작동하고 잘못된 tableView 업데이트 오류로 iOS 6 시뮬레이터에 충돌하는 것입니다.
누군가가 문제가있는 곳을 말해 줄 수 있습니까?
-(void)moveRowToFavourites:(id)sender{
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)button.superview.superview;
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
[tempArray addObject:[NSIndexPath indexPathForRow:favouritesArray.count inSection:0]];
[favouritesArray insertObject:cell.textLabel.text atIndex:favouritesArray.count];
[[self tableView] beginUpdates];
[[self tableView] insertRowsAtIndexPaths:(NSArray *)tempArray withRowAnimation:UITableViewRowAnimationFade];
[[self tableView] endUpdates];
}
편집
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(searching){
return [self.searchResults count];
}
else{
if ([[arrayForBool objectAtIndex:section] boolValue]) {
if(section == 0){
return favouritesArray.count;
}else{
NSString* key = [self.proCategoriesArray objectAtIndex:section - 1];
NSArray *aArray = [sectionContentDict valueForKey:key];
return aArray.count;
}
}
return 1;
}
}
오류 설명에 문제의 명확한 설명이 포함되어 있습니다. –
업데이트 대신 reloadData를 시도 했습니까? –
무엇이 오류입니까? –