小编Bub*_*Mop的帖子

prepareForSegue被调用两次,在演示文稿正在进行时尝试显示<UINavigationController>

我是ios编程的新手,在这里问,但我一直都在访问!我很难理解为什么我遇到这个问题,它编译没有错误,我检查并检查了我的MainStoryboard中的所有插座和标识符.

我有2个UITableViewControllers,当用户选择表中的项时,我从第一个到第二个传递一个字符串,所以在FirstTableViewController.m中

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    int sel = indexPath.row;
    if (sel == 0) {
        _keyName = [NSString stringWithString:_string1];
        NSLog(@"the table was selected at cell 0, %@", _string1);
    }
    if (sel == 1) {
        _keyName = [NSString stringWithString:_string2];
    }
    // more code below...
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"ResultsSegue"])
    {
        UINavigationController *navigationController = segue.destinationViewController;
        ResultsViewController *rv = [[navigationController viewControllers] objectAtIndex:0];
        [rv setResults: _keyName];
        NSLog(@"in the progress view, %@", _keyName);
        //rv.delegate = (id)self;
        rv.delegate = self; …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

11
推荐指数
1
解决办法
7549
查看次数

标签 统计

ios ×1

objective-c ×1