这一行:
PFUser * user = [self.frIEnds objectAtIndex:indexPath.section];
无论我在该部分中使用什么名称,都只返回每个部分中的第一个用户名.所以我需要另外访问Row,而不仅仅是部分.
- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDSelectRowAtIndexPath:(NSIndexPath *)indexPath {[self.tableVIEw deselectRowAtIndexPath:indexPath animated:NO];UItableVIEwCell *cell = [tableVIEw cellForRowAtIndexPath:indexPath];int section = indexPath.section;int row = indexPath.row;NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:row inSection:section];NSLog(@"newIndexPath: %@",newIndexPath);PFUser *user = [self.frIEnds objectAtIndex:indexPath.section];if (cell.accessoryType == UItableVIEwCellAccessoryNone) { cell.accessoryType = UItableVIEwCellAccessorycheckmark; [self.recipIEnts addobject:user.objectID];NSLog(@"added:%@",user);}else { cell.accessoryType = UItableVIEwCellAccessoryNone; [self.recipIEnts removeObject:user.objectID]; NSLog(@"removed:%@",user);}[self.currentUser saveInBackgrounDWithBlock:^(BOol succeeded,NSError *error) { if (error) { NSLog(@"Error %@ %@",error,[error userInfo]); }}];}@H_403_4@解决方法 嗨,这是足够的尝试,让我知道你是否面临任何问题…
- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDSelectRowAtIndexPath:(NSIndexPath *)indexPath {[self.tableVIEw deselectRowAtIndexPath:indexPath animated:NO];NSArray * nameArray = [self.sectionsArray objectAtIndex:indexPath.section];PFUser *user = (PFUser*)[nameArray objectAtIndex:indexPath.row];// PFUser *user = (PFUser*)[self.frIEnds objectAtIndex:indexPath.section];if (cell.accessoryType == UItableVIEwCellAccessoryNone) { cell.accessoryType = UItableVIEwCellAccessorycheckmark; [self.recipIEnts addobject:user.objectID];NSLog(@"added:%@",user);}// this is enough}@H_403_4@ @H_403_4@ @H_403_4@ @H_403_4@ 总结
以上是内存溢出为你收集整理的ios – 在tableView中获取section index的行全部内容,希望文章能够帮你解决ios – 在tableView中获取section index的行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)