在详细信息视图上调用reloadData后,将在主视图中删除选择

时间:2014-07-10 14:37:55

标签: uitableview ios7

我有一个拆分视图控制器作为根控制器,两个(主,详细)都扩展为UITableViewController。因此,每当我在主视图单元格上进行选择时,都会显示详细信息视图,然后主视图单元格上的cell.selectionStyle被删除(显然)。

在加载表视图数据(viewDidLoad)或重新加载后发生。

任何人遇到此类问题或有任何知识/解决方法???在这个意义上,细节视图控制器如何影响主控..

修改

我有一个带有UITableViewController的弹出式菜单,主视图单元格在弹出时显示相同的行为。但另一个细节视图控制器使用Collectionviewcontroller扩展,当这个显示时,主视图即表视图单元格...不显示异常

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.tableView registerNib:[UINib nibWithNibName:@"EventRowCell" bundle:nil] forCellReuseIdentifier:[EventRowCell identifier]];

    [self loadCalendarResultController]; // NSFetchedResultsController stuff...
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return [[self.resultController sections] count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    id<NSFetchedResultsSectionInfo> sectionInfo = [[self.resultController sections] objectAtIndex:section];
    return [sectionInfo numberOfObjects];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 125.0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    EventRowCell *cell = [tableView dequeueReusableCellWithIdentifier:[EventRowCell identifier] forIndexPath:indexPath];
if (cell == nil) {
    cell = [[EventRowCell alloc] initWithStyle:UITableViewStylePlain reuseIdentifier:[EventRowCell identifier]];
}
    cell.textLabel.text = @"text";
    return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    id<NSFetchedResultsSectionInfo> sectionInfo = [[self.resultController sections] objectAtIndex:section];
    static NSDateFormatter *formatter = nil;

    if (!formatter)
    {
        formatter = [[NSDateFormatter alloc] init];
        [formatter setCalendar:[NSCalendar currentCalendar]];
        NSString *formatTemplate = [NSDateFormatter dateFormatFromTemplate:@"dd MMMM eeee" options:0 locale:[NSLocale currentLocale]];
        [formatter setDateFormat:formatTemplate];
    }
    return [formatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:[[sectionInfo name] doubleValue]]];
}

- (NSFetchedResultsController *) loadresultController {
    if (_resultController != nil) {
        return _resultController;
    }
    _resultController = [[DataManager instance] getCalendarResults:self.module withDelegate:self];
    return _resultController;
}

MasterViewController 使用NSFetchRequest获取数据,自定义单元格。

DetailViewController 使用NSFetchedResultsController获取数据,自定义单元格。

0 个答案:

没有答案