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

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

这是我的代码。我只想在选择行时可以跳转到 personViewController 页面,但这似乎很糟糕。

4

2 回答 2

0

尝试这个..

//_personViewController.user=_user;

或者

_personViewController.user=[_user retain];
于 2012-05-25T11:51:38.760 回答
0

只需检查它是否写入导航控制器 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions,它是 AppDelegate.m 文件。

 - (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;
    }
于 2012-05-25T12:39:37.793 回答