Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c didSelectRowAtIndexPath当select无法转到其他页面时_Objective C_Didselectrowatindexpath - Fatal编程技术网

Objective c didSelectRowAtIndexPath当select无法转到其他页面时

Objective c didSelectRowAtIndexPath当select无法转到其他页面时,objective-c,didselectrowatindexpath,Objective C,Didselectrowatindexpath,这是我的密码。我只想在选择行时跳转到personViewController页面,但这似乎不好。试试这个 if(!_personViewController) { _personViewController=[[PersonViewController alloc]initWithNibName:@"PersonViewController" bundle:nil]; } _personViewController.user=_user; [se

这是我的密码。我只想在选择行时跳转到personViewController页面,但这似乎不好。

试试这个

if(!_personViewController)
    {
        _personViewController=[[PersonViewController alloc]initWithNibName:@"PersonViewController" bundle:nil];
    }

    _personViewController.user=_user;
    [self.navigationController pushViewController:_personViewController animated:YES];
    [PersonViewController release];


只需检查是否在-BOOLapplication:UIApplication*application didfishlaunchingwithoptions:NSDictionary*launchOptions中编写导航控制器,它是AppDelegate.m文件

_personViewController.user=[_user retain];

PersonViewController是一个类。你不应该试图释放它…尽管这可能与你的症状无关。您能否设置断点来验证代码是否实际正在执行?
_personViewController.user=[_user retain];
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {

        self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
       UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController:self.viewController];

        [self.window addSubview:[navControl view]];

        [self.window makeKeyAndVisible];
        return YES;
    }