2014-11-03 84 views

回答

0

我假设你知道你要选择一个指数? 这是一个有点不清楚所需的标准是找到正确的groups

否则,你就需要一个for循环来找到它在你的fetchedResults

// for loop around _group to find the index 

NSInteger index = -1; 

for (NSInteger i = 0; i < [_group count]; i++) { 

    NSManagedObject *groups = [_group objectAtIndex:i]; 

    if (selectedgroup != nil && groups == selectedgroup) { 

     index = i; 
     break; 
    } 
} 

if (index != -1) 
    [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] animated:NO scrollPosition:UITableViewScrollPositionTop]; 

我还假设你只有1款,如你正在拔出管理对象indexPath.row

+0

我通过从另一个视图控制器“selectedgroup”组tableviewcontroller,我希望检查组tableviewcontroller如果“selectedgroup”存在然后选择在视图组中的tableview确实出现 – 2014-11-04 14:49:44

+0

查看编辑....虽然我觉得你可以自己完成了if语句 – Magoo 2014-11-04 22:42:39

+0

这不是工作一个把一些突破点请参阅编辑 – 2014-11-05 16:17:09