我已經加入導航控制器到我器件的應用在didFinishLaunchingWithOptions這樣navigationcontroller導致應用程序崩潰
LoginViewController *mainView = [[[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:nil] autorelease];
navigationController = [[[UINavigationController alloc]initWithRootViewController:mainView]autorelease];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
在我LoginViewController的viewDidLoad我有,
self.navigationItem.hidesBackButton = YES;
[super viewDidLoad];
UIImage *img = [[UIImage alloc] init];
img = [UIImage imageNamed:@"top_bar.png"];
bar = [self.navigationController navigationBar];
[bar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
UIImage *signIn = [UIImage imageNamed:@"signin_btn.png"];
UIButton *phButton = [UIButton buttonWithType:UIButtonTypeCustom];
[phButton setImage:signIn forState:UIControlStateNormal];
phButton.frame = CGRectMake(0.0, 0.0, signIn.size.width, signIn.size.height);
UIBarButtonItem *phBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:phButton];
self.navigationItem.rightBarButtonItem = phBarButtonItem;
[phButton addTarget:self action:@selector(checkConnection) forControlEvents:UIControlEventTouchUpInside];
[phButton release];
,當我在我的手機上運行的應用程序它崩潰。當我從appDelagate刪除導航控制器它的工作原理...Ÿ我不能讓我的導航正常工作,我怎麼能避免它墜毀。
請添加您在控制檯中出現錯誤。 – hchouhan02 2012-03-26 06:50:39