문제

SWRevealViewController로 작업하여 응용 프로그램에 측면 메뉴가 있습니다. 측면 메뉴에서 컨트롤러로 예상대로 작동합니다. 지금 내가하고 싶은 일은 하나의 컨트롤러에서 다른 컨트롤러에서 다른 컨트롤러에서 다른 컨트롤러로 다시 사용하는 것입니다.

사이드 메뉴에서 컨트롤러 1에서 컨트롤러 2 :

여기에 이미지 설명

이것은 내가 지금까지하려고 노력한 것입니다 :

interface 빌더에서 SWRevealViewController를 사용하여 두 번째 컨트롤러로 UITableViewController를 설정합니다.

및 첫 번째 컨트롤러에서는 Real View Controller Segueidentifier "articlesSegue"를 사용하여 두 번째 컨트롤러를 표시합니다.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Set selected issue to var
    _selectedIssue = _feedItems[indexPath.row];

    // Manually call segue to detail view controller
    [self performSegueWithIdentifier:@"articlesSegue" sender:self];
}

#pragma mark Segue

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get reference to the destination view controller
    TableViewController *tableVC = segue.destinationViewController;

    // data used in the second Controller
    tableVC.self.type = @"category";
    tableVC.self.data = [_selectedIssue.ID stringValue];
}
.

목록에서 항목을 선택하면 선택된대로 표시되지만 아무 일도 일어나지 않습니다.

여기에 이미지 설명

Push Segue를 사용하여 테스트를 테스트했으며 작동시켜 왔으며 didSelectRowAtIndexPath로 작업하는 것이 좋습니다.

나는이 질문을 찾지 못했지만 그것이 어떻게 구현되어야하는지, SWREVEALVIEWCONTROLLER - 수동으로 다른보기로 전환합니까? .

도움이 되었습니까?

해결책

@ anbu.kathik은 SWReveal에서 다른 Controller로 이동하려면 Controller를 사용할 수 없습니다.동일한 TableViewController를 사용하여 해결했습니다. Property type를 추가하여 현재 '테이블보기'를 확인하고 didSelectRowAtIndexPath에서 항목을 선택한 경우 테이블을 업데이트하기 만하면됩니다.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // check type of current tableview - if category display article
    if ([self.type isEqualToString:@"category"]) {
        // display single article
        _selectedArticle = _feedItems[indexPath.row];
        [self performSegueWithIdentifier:@"detailSegue" sender:self];
    }
    else {
        // else if issue display list of articles on the same TableViewController
        _selectedIssue = _feedItems[indexPath.row];
        self.type = @"category";
        self.data = [_selectedIssue.ID stringValue];
        [_homeModel downloadItems:self.type :self.data];
    }
}
.

[self.tableView reloadData]를 사용하여 테이블을 새 데이터로 다시로드합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top