在我的iphone應用程序中我有這個pb:Application tried to push a nil view controller on target <UINavigationController:
我有一個視圖控制器包含一個tableview,我希望如果一行被選中一個其他視圖控制器是顯示。 這裏是我的代碼:應用程序試圖推動一個無視圖控制器的目標<UINavigationController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row==3){
NSLog(@"RecherchePartenaireDistanceViewController...");
recherchePartenaireDistanceViewController = [[RecherchePartenaireDistanceViewController alloc] init];
self.recherchePartenaireDistanceViewController=recherchePartenaireDistanceViewController.recherchePartenaireViewController;
[self.navigationController pushViewController:recherchePartenaireDistanceViewController animated:YES];
[recherchePartenaireDistanceViewController release];
}
}
在RecherchePartenaireDistanceViewController.h:
@class RecherchePartenaireViewController;
@interface RecherchePartenaireDistanceViewController : UIViewController {
RecherchePartenaireViewController *recherchePartenaireViewController;
}
@property (nonatomic, retain) IBOutlet RecherchePartenaireViewController *recherchePartenaireViewController;
@end
和RecherchePartenaireDistanceViewController.m
#import "RecherchePartenaireDistanceViewController.h"
#import "RecherchePartenaireViewController.h"
@implementation RecherchePartenaireDistanceViewController
@synthesize recherchePartenaireViewController;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)dealloc
{
[super dealloc];
[recherchePartenaireViewController release];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
問題出在哪裏?我真的看不到它。請heeelp ....
與此沒有什麼變化.. – Gabrielle